include("../include.php"); writeHeader("Limit input to a set of characters", "Programming » Visual Basic 6 » Visual Basic 6 Code » Controls » Textbox » ");?>
Function LimitTextInput(ByVal source As Integer, _ Optional ByVal limitTo As String = "0123456789.") As String 'put the next line in the Textbox_KeyPress event 'KeyAscii = LimitTextInput(KeyAscii) 'backspace = 8 If source <> 8 Then If InStr(limitTo, Chr(source)) = 0 Then LimitTextInput = 0 Exit Function End If End If LimitTextInput = source End Function