'Limit text input and goto next textbox 'Of course you can set this also with the properties MaxLenght and TabIndex 'but if thats not enough: 'make a new project with a form and 3 textboxen (index 0,1,2) 'in the textbox(0) you can put 10 characters 'in the textbox(1) you can put 20 characters 'in the textbox(2) you can put 30 characters 'because it's in the keypress_event you get alwaus one character more 'in the CountCharacter you can chech on other Ascii-codesReturnas
well Option Explicit Dim MaxCharactersas
Integer Dim intCharactersas
Integer Dim intTxtBoxas
Integer Privatesub
Text1_GotFocus(Indexas
Integer) intCharacters = 0select
case
Indexcase
0 MaxCharacters = 9 intTxtBox = 1case
1 MaxCharacters = 19 intTxtBox = 2case
2 MaxCharacters = 29 intTxtBox = 0end
Select End Sub Privatesub
Text1_KeyPress(Indexas
Integer, KeyAsciias
Integer) CountCharacters (KeyAscii) End Sub Function CountCharacters(source) 'put the next line in the Textbox_KeyPress event 'CountCharacters(KeyAscii) 'backspace =8 If source <> 8 Then 'count characters intCharacters = intCharacters + 1 'if there aremore
than you want If intCharacters > MaxCharacters Then 'goto next textbox Text1(intTxtBox).SetFocus Exit Functionend
If Else intCharacters = intCharacters - 1end
If CountCharacters = intCharacters End Function