Use the KeyPress event of a text box to capture the KeyAscii of each typed character. Then do something like:
VB Code:
intAscii = KeyAscii If intAscii > 128 then strBinary = 1 intAscii = intAscii - 128 Else strBinary = 0 End if If intAcii > 64 Then strBinary = strBinary & 1 intAscii = intAscii - 64 Else strBinary = 0 End if etc...
or to shorten it up you can do:
VB Code:
intAscii = KeyAcii intCurrent = 128 For i = 1 to 8 If intAcii > intCurrent then strBinary = strBinary & 1 intAcii = intAcii - intCurrent Else strBinary = strBinary & 0 End if intCurrent = intCurrent / 2 Next
Hope this helps.




Reply With Quote