|
-
May 8th, 2000, 07:48 PM
#1
Thread Starter
New Member
I need to change a string which is a 12 bit binary value into its decimal equivilant.
Any easy way?
Cheers in advance
Andy Dunn
-
May 8th, 2000, 07:55 PM
#2
Fanatic Member
Go back to your original question.
http://forums.vb-world.net/showthrea...threadid=15507
Stevie-O has the solution.
call it like this.
Code:
MsgBox CvtBase("000000001111", 2, 10)
Iain, thats with an i by the way!
-
May 9th, 2000, 03:00 PM
#3
Hyperactive Member
Hello Andy Dunn,
I think this is the most easiest way
Private Sub Command1_Click()
Answer = 0
For N = 0 To Len(Text1.Text) - 1
Answer = Answer + Mid(Text1.Text, (Len(Text1.Text) - N), 1) * 2 ^ N
Next
End Sub
Michelle.
-
May 9th, 2000, 09:17 PM
#4
Addicted Member
I use this function to convert:
Function conv_bin_dec(bite) As Integer
Y = Len(bite) - 1
For x = 1 To Len(bite)
conv_bin_dec = conv_bin_dec + ((2 ^ Y)) * (Mid$(bite, x, 1))
Y = Y - 1
Next x
End Function
Remember Programmers don't sleep 
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
|