Perhaps this is what you're looking for? It's written in VB6, but may also work in later versions.
[CODE=vb]Public Function Bin(ByVal ByteValue As Byte) As String
Dim I As Long, BitValue As Long, BitWeight As Long
For I = 0 To 7
BitWeight = 2 ^ (7 - I)
BitValue = ByteValue \ BitWeight
Bin = Bin & Format(BitValue )
ByteValue = ByteValue - BitValue * BitWeight
Next
End Function[/CODE]
Perhaps this is what you're looking for? It's written in VB6, but may also work in later versions.
[CODE=vb]Public Function Bin(ByVal ByteValue As Byte) As String
Dim I As Long, BitValue As Long, BitWeight As Long
For I = 0 To 7
BitWeight = 2 ^ (7 - I)
BitValue = ByteValue \ BitWeight
Bin = Bin & Format(BitValue )
ByteValue = ByteValue - BitValue * BitWeight
Next
End Function[/CODE]
Erm...I quite not really understand about the code..Can u pls explain it ?
thanks ya...
Erm...I quite not really understand about the code..Can u pls explain it ?
thanks ya...
Well, since it's a function, you don't necessarily have to understand it. That's the beauty of a function - it can be used as a "black box" without worrying about the "innards".
It takes in a byte value, and returns the string of "0" and "1" indicating the binary value of the byte. Try passing values to it from the immediate window. For example...
Print Bin(38)
If this isn't what you were after, then please explain further.
Comment