|
-
Sep 10th, 2006, 12:39 PM
#1
Thread Starter
New Member
[2005] need help with some vb code
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|