Key Press in Phone Fields

  • Thread starter Thread starter Michael Murschell
  • Start date Start date
M

Michael Murschell

I have 3 fields for the phone number, and I want to have it automatically
jump to the next field when 3 characters are entered into the first or
second field.

How do I do this?

Thank you,
Mick
 
* "Michael Murschell said:
I have 3 fields for the phone number, and I want to have it automatically
jump to the next field when 3 characters are entered into the first or
second field.

Why not use a masked edit control?

<http://www.codeproject.com/cs/miscctrl/maskedcsedit.asp>
<http://www.codeproject.com/vb/net/maskedbox_control.asp>
<http://www.codeproject.com/vb/net/validtext3.asp>
<http://www.codeproject.com/vb/net/cpflexmaskeditbox.asp>
<http://www.codeproject.com/useritems/ValidText.asp>
....
 
in addition
if you want to keep your existing layout.
1 of the things you can use is textchanged event of the textbox
just check the length of the textbox.text

Private Sub txtX_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtX.TextChanged
If txtZoek.Text.Length >= 3 Then
txtnext.focus()
End If
End Sub

eric
 
Hello,

here is my code, try this

Private Sub txtcode1_Change()
If Len(txtcode1.Text) = 1 Then
txtcode2.SetFocus
End If
End Sub


Private Sub txtcode2_Change()
If Len(txtcode2.Text) = 2 Then
txtcode3.SetFocus
End If
End Sub


Private Sub txtcode3_Change()
If Len(txtcode3.Text) = 2 Then
txtcode4.SetFocus
End If
End Sub


Thanks,

Warm Regards,

Ayaz Ahmed
Software Engineer & Web Developer
Creative Chaos (Pvt.) Ltd.
"Managing Your Digital Risk"
http://www.csquareonline.com
Karachi, Pakistan
Mobile +92 300 2280950
Office +92 21 455 2414
 
Back
Top