
December 1st, 2007, 11:23 PM
|
|
Registered User
|
|
Join Date: Oct 2007
Posts: 4
Time spent in forums: 2 h 13 m 38 sec
Reputation Power: 0
|
|
Thanks for the help. I got it worked out. If you're interested this is the variation I got to work.
Code:
Public Function BinaryToDecimal(ByRef Binary As String) As Integer
Dim BinaryNum As Integer
Dim BitCount As Short
For BitCount = 1 To Len(Binary)
BinaryNum = BinaryNum + (CDbl(Mid(Binary, Len(Binary) - BitCount + 1, 1)) * (2 ^ (BitCount - 1)))
Next BitCount
BinaryToDecimal = BinaryNum
End Function
Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
txtDecimalNum.Text = (BinaryToDecimal((txtBinaryNum.Text)))
End Sub
|