Thanks for all the idea,
my final solution is now
On Form1 are 2 TextBox Controls:
Sub App_Start
AddEvent("TextBox1",KeyPress,"TextBox_maxC5_KeyPre ss")
AddEvent("TextBox2",KeyPress,"TextBox_maxC5_KeyPre ss")
Form1.Show
End Sub
Sub TextBox_maxC5_KeyPress (key)
If StrLength(Control(Sender))=5 AND _
( IsLetter(key) OR IsNumber(key) ) Then
Control(Sender).IgnoreKey
End If
End Sub
|