HighAndWilder
Well-known Member
- Joined
- Nov 4, 2006
- Messages
- 660
- Office Version
- 365
- Platform
- Windows
Hi All
I am trying to implement a textbox on a form that enables a user to enter a time e.g. 070000. Once I can do that i will try to allow colons in the appropriate places.
In the first phase, if any other characters that 0-9 are entered they will be invalid and removed from the textbox.
I can detect the key that has been pressed using :
If KeyAscii < 48 Or KeyAscii > 57 Then ' 0-9
blnInvalidKey = True
End If
but I need to remove the invalid character from the textbox.
If I do this in the texttbox Change event then the Change event is triggered again which is not what I need.
How do others tackle such a requirement.
Thanks in anticipation.
I am trying to implement a textbox on a form that enables a user to enter a time e.g. 070000. Once I can do that i will try to allow colons in the appropriate places.
In the first phase, if any other characters that 0-9 are entered they will be invalid and removed from the textbox.
I can detect the key that has been pressed using :
If KeyAscii < 48 Or KeyAscii > 57 Then ' 0-9
blnInvalidKey = True
End If
but I need to remove the invalid character from the textbox.
If I do this in the texttbox Change event then the Change event is triggered again which is not what I need.
How do others tackle such a requirement.
Thanks in anticipation.