-
Hi,
I have asked this question before but I can't remember the answer (sorry). I have a text box called txtDecimal and would like to translate the number in there into Binary and then display it in a label called lblBinary. Could somebody please help?
Thanks
-
This code was taken from this site:
Code:
Public Sub DecBin(Adecimal, jbin As String)
'Convert integer value to an equivalent string of binary digits
jbin = ""
h = Hex(Adecimal) 'convert from integer to hexadecimal
For i = 1 To Len(h)
digit = InStr("0123456789ABCDEF", Mid(h, i, 1)) - 1
j = 8
k = 4
Do 'convert from hexadecimal to binary
jbin = jbin + Right(Str((digit ^ j) Mod 2), 1)
j = j - (j ^ 2)
k = k - 1
If k = 0 Then Exit Do
Loop While j
Next i
End Sub
------------------
r0ach(tm)