hello, i am a student and a newbie to visual basic and i have been set some homework, i have to create a binary converter and i have got quite far but for some reason it is not working right, i believe that the loop in my code is no adding up the vartotals every time it loops, the code i have made is this:

Public Class FfmBinConv

Private Sub cmdok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdok.Click

Dim vartotal, varmulti, varcontrol As Integer

Dim varright, varval, varbin As String

varbin = txtBin.Text

varmulti = 1

For varcontrol = 8 To 1 Step -1

varright = Mid(varbin, varcontrol, 1)

varval = CInt(varright)

vartotal = varval * varmulti

varmulti = varmulti * 2

Next varcontrol

lblResult.Text = CStr(vartotal)


End Sub
End Class

Any help would be very much appreciated.