I have code to check the input for specific characters in a text box.
My code catches the incorrect characters, gives a warning, but after the user closes the msgbox, the incorrect character is still entered![]()
I am sure this will be a simple solution but I can't figure it out at the moment.![]()
I have tried the following code in the KeyDown, KeyPress and the KeyUp and I get the same problem each time.
vb Code:
Dim tmpDate As String tmpDate = txtMembership(Index).Text Select Case Index Case 11, 12, 13, 15 Select Case KeyAscii Case 8 'backspace Case 47 '/forward slash Case 48 To 59 'numbers Case 127 'Delete key Case Else MsgBox "You can only enter numbers and the ' / ' seperator when entering dates.", _ vbOKOnly + vbInformation, "Date Format" 'remove last character entered 'Exit Sub txtMembership(Index).Text = tmpDate End Select End Select




Reply With Quote