As long as my program runs, how do i restrict the characters to be entered into a txt box only to 1 and 0(for binaries)?api?
Printable View
As long as my program runs, how do i restrict the characters to be entered into a txt box only to 1 and 0(for binaries)?api?
Try this:
Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case vbKey0
Exit Sub
Case vbKey1
Exit Sub
Case vbKeyBack
Exit Sub
Case Else
KeyAscii = 0
End Select
End Sub
Great! thankx. btw, why does it say exit sub if it is 1 or 0?
it doesn't have to in his example. You could leave the case statements blank. The important one is the case else.