You can start with this function and modify it to make restrict keys if you like. This function will only allow the user enter the Keys you specify on the keyboard.
Code:Public Sub Text1_KeyPress(KeyAscii As Integer) KeyAscii = fnValiText (KeyAscii,"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",True) End Sub Public Function fnValiText(arg_sKeyIn As Integer, arg_strValidateString As String, arg_bEditable As Boolean) As Integer 'Dim member variables Dim m_strValidateList As String Dim m_sKeyOut As Integer If arg_bEditable = True Then m_strValidateList = UCase(arg_strValidateString) & Chr(8) Else m_strValidateList = UCase(arg_strValidateString) End If If InStr(1, m_strValidateList, UCase(Chr(arg_sKeyIn)), 1) > 0 Then m_sKeyOut = arg_sKeyIn Else m_sKeyOut = 0 End If fnValiText = m_sKeyOut End Function




Reply With Quote