Unwanted Char - OnKeypress event
Hello all,
to increase datainput speed i have added code to a text box so if the letter "t" is pressed, todays date is entered. The date does appear but the letter "t" is inserted too, any way of stopping this other than check the whole string for a "t" and then remove it?
this is my OnKeypress code:
Private Sub Call_Up_Date_KeyPress(KeyAscii As Integer)
Dim strKey As String
Dim dateTODAY As Date
Dim strTodaysDate As String
' Get todays date
dateTODAY = DateTime.Date
strTodaysDate = CStr(dateTODAY)
' Convert ANSI value to character string.
strKey = Chr(KeyAscii)
If strKey = "t" Then
Me.Call_Up_Date.Text = strTodaysDate
End If
End Sub
Thanks in advance
|