Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Form Cursor Placement

Status
Not open for further replies.

ynnepztem

Programmer
Aug 2, 2001
54
US
I am using VB.Net, SQL Server 2000, Windows 2000. I have an application where a user needs to enter a number into three separate text boxes. The first one has a max length of 3, the second, 1 and the third 4. I don't want them to have to tab or click into the next box. How can I tell the cursor to setfocus into the next box when the maxlength has been reached. I could do this in VB6 very simply and I know how to send the cursor to another text box when coming from an error message or on form load. Any help would be greatly appreciated.
 
In the Textbox1_TextChanged event:

Code:
        If Len(TextBox1.Text) = 9 Then
            TextBox2.Focus()
        End If

- B
 
Thanks for the quick response. This code works for a Windows form but not for a Web form. Thanks for trying anyway.
 
I would ask this in the ASP.Net forum. It probably requires some client side code in JavaScript.

Brian's code MAY work if you change the textboxes to autopostback. But I don't think you would want to do that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top