473,324 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Text box to go to next tab index control

When the max length of a text box has been reached, I want the focus to go to
the next control based on tab index. How do I code or what property do I set?
Dec 7 '05 #1
2 19120
You could do something similar to the following.

private void textBox1_TextChanged(object sender, System.EventArgs e)
{
if (this.textBox1.TextLength == this.textBox1.MaxLength)
{
this.SelectNextControl(this.textBox1, true, true, true, true);
}
}

--
Tim Wilson
..NET Compact Framework MVP

"Mike L" <Ca***@nospam.nospam> wrote in message
news:9D**********************************@microsof t.com...
When the max length of a text box has been reached, I want the focus to go to the next control based on tab index. How do I code or what property do I

set?
Dec 8 '05 #2
Tim Wilson wrote:
You could do something similar to the following.

private void textBox1_TextChanged(object sender, System.EventArgs e)
{
if (this.textBox1.TextLength == this.textBox1.MaxLength)
{
this.SelectNextControl(this.textBox1, true, true, true, true);
}
}


I'd do it on KeyUp, because I believe TextChanged doesn't fire until the
control loses focus (i might be thinking of javascript though).

private void textBox1_KeyUp(object sender, KeyEventArgs e) {
if (textBox1.TextLength == textBox1.MaxLength) {
textBox2.Focus();
}
}

actually I just tried it and textchanged does work after every keypress.
So either TextChanged or KeyUp will work for you.
Dec 8 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Abhijeet Kumar | last post by:
Hi How can i justify align text on Label Control. I am working in C# Desktop application
2
by: Charles | last post by:
Hello, I am in ASP.NET using C#. I have a user control called "progHeader.ascx" that has a label control call "pageTitle". How do I call "pageTitle" from my asp page(Inventory.aspx), with the...
5
by: John Saunders | last post by:
Is this ok? I haven't seen any examples of it, but it looks like it should work: <asp:requiredfieldvalidator id="valreqUserName" runat="server" controltovalidate="txtUserName"...
8
by: EEEdiot | last post by:
Does anyone know of a good rich text editor web control for ASP.NET that is *free*? TIA.
4
by: aiki727 | last post by:
I am working on an application in which I would like to change the existing text in the control (system) menu (the menu that appears when the form icon is clicked). Specifically, I would like to...
7
by: ashkaan57 | last post by:
Hi, I am new to CSS. I want to have an image (170x250) centered and have some text to the right of it, starting from top of the image. I have: ..info { position: absolute; top:100px;
0
by: RateTheBuilder | last post by:
Hi I found the below scripts which are used to dynamically resize the height of the text area input control. The site I found it on www.webdeveloper.com had it being called with the following...
3
by: mudassir368 | last post by:
How to select text in textbox control, if it is focussed using javascript
2
by: Dinu | last post by:
Hi how to get text of a control in itemtemplate of gridview and how can we access and set it properties dynamycally?? Thanks
2
by: Toni | last post by:
I am using .NET 2.0, windows aplication. I am trying to get or recognize selected text from WebBrowser control but I can't! Is it possible and how to do it?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.