T
twas via AccessMonster.com
How do I drop all but hex characters (0-9, A-F) from a text box while
allowing use of copy paste, and delete keys? I was thinking that a routine
like
Private Sub txtControl_KeyPress(KeyAscii As Integer)
dim strChar as string
strChar = UCase$(Chr$(KeyAscii))
If (strChar >= "0" And strChar <= "9") _
Or (strChar >= "A" And strChar <= "F") then
' good hex character
Else
KeyAscii = 0 ' cancel keystroke
End If
End Sub
might work, but how do I:
1) convert all the input characters to upper case
2) make sure that the user pasting a string into the control works
3) warn the user if the length of the resultant entry in the text box is
incorrect (a validation rule would force compliance, but that might
compromise interface usability)
thanks
allowing use of copy paste, and delete keys? I was thinking that a routine
like
Private Sub txtControl_KeyPress(KeyAscii As Integer)
dim strChar as string
strChar = UCase$(Chr$(KeyAscii))
If (strChar >= "0" And strChar <= "9") _
Or (strChar >= "A" And strChar <= "F") then
' good hex character
Else
KeyAscii = 0 ' cancel keystroke
End If
End Sub
might work, but how do I:
1) convert all the input characters to upper case
2) make sure that the user pasting a string into the control works
3) warn the user if the length of the resultant entry in the text box is
incorrect (a validation rule would force compliance, but that might
compromise interface usability)
thanks