-
Hi,
I need to convert a decimal value into a binary value, and I don't know how!!
It is a decimal value from 0 to 255 (8 bit long)
Then I need every single bit, for putting pixels on my screen. Every bit represents a pixel wich can be black or white. How can I do that????
TNX
Viperke
-
Code:
Binary=int(Dec/128) & int(Dec/64) mod 2 & int(Dec/32) mod 2 & int(Dec/16) mod 2 & int(Dec/8) mod 2 & int(Dec/4) mod 2 & int(Dec/2) mod 2 & Dec mod 2
-
Convertion dec ->> bin
TNX kendaman
I'll try it
Viperke
-
Code:
Public Function Dec2Bin(lNumber As Long) As String
Dim iLoopCounter As Integer
If lNumber >= 2 ^ 31 Then
Dec2Bin = "Too big"
Exit Function
End If
Do
If (lNumber And 2 ^ iLoopCounter) = 2 ^ iLoopCounter Then
Dec2Bin = "1" & Dec2Bin
Else
Dec2Bin = "0" & Dec2Bin
End If
iLoopCounter = iLoopCounter + 1
Loop Until 2 ^ iLoopCounter > lNumber
End Function
-
Thanks
TNX parksie
I'll also try these code!!
TNX again..
Viperke