|
-
Oct 20th, 1999, 12:26 PM
#1
Thread Starter
Addicted Member
I couldn't find any function/method to do the conversion!!
Any help?
Thanx
-
Oct 20th, 1999, 12:44 PM
#2
Addicted Member
Converting to a Binary string is not directly available within VB as far as I know. If for some reason you actually need a value to display in binary then you can create a function that does this for you. Just declare an Array of Bits then convert the Asc value to its Decimal integer value. Then divide the Decimal value by two repeatedly. Each time you divide by two, the remainder is a bit. Typecast that bit to a string.
If your wanting to use the binary number just within your code manipulation, there isn't anything you can't already do with the Chr, Asc, Bit, Byte, and &H. All those types can handle just about anything.
Laters,
Phil
-
Oct 20th, 1999, 12:53 PM
#3
Thread Starter
Addicted Member
Again, Philip thank you..
-
Jan 18th, 2000, 07:38 AM
#4
this will give you the binary string equivalent of every asc number (0-255) using the And function
(both have to be the same to give a 1
example:
10010101
00101001 and
=01000011 )
For k = 0 To 255
Temp = ""
For j = 7 To 0 Step -1
If k And (2 ^ j) Then
Temp = Temp & "1"
Else
Temp = Temp & "0"
End If
Next j
RL88(k) = Temp
Next k
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
|