473,574 Members | 2,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 19134
You could do something similar to the following.

private void textBox1_TextCh anged(object sender, System.EventArg s e)
{
if (this.textBox1. TextLength == this.textBox1.M axLength)
{
this.SelectNext Control(this.te xtBox1, true, true, true, true);
}
}

--
Tim Wilson
..NET Compact Framework MVP

"Mike L" <Ca***@nospam.n ospam> wrote in message
news:9D******** *************** ***********@mic rosoft.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_TextCh anged(object sender, System.EventArg s e)
{
if (this.textBox1. TextLength == this.textBox1.M axLength)
{
this.SelectNext Control(this.te xtBox1, 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.TextL ength == textBox1.MaxLen gth) {
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
3586
by: Abhijeet Kumar | last post by:
Hi How can i justify align text on Label Control. I am working in C# Desktop application
2
1507
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 usercontrol "progheader" dropped on to it, and send the current page title to "pageTitle"? Charles
5
1751
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" errormessage="Please enter the user name"> <span title="Please enter the user name"> <img src="../../images/bullet.gif"> </span>
8
9710
by: EEEdiot | last post by:
Does anyone know of a good rich text editor web control for ASP.NET that is *free*? TIA.
4
1262
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 change the 'Close' item text to something else. I have searched the web extensively and many books on the subject and have come up empty. The only...
7
13822
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
1440
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 event of the text area control: onfocus="adjustRows(this)" The problem is I want these to be called when the control is loaded rather than onFocus....
3
2432
by: mudassir368 | last post by:
How to select text in textbox control, if it is focussed using javascript
2
5465
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
5435
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
7835
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7753
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8095
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8265
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8132
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5332
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3787
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2265
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1365
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.