473,320 Members | 1,853 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,320 software developers and data experts.

Custom Text Box go to next Text Box

Custom text box to go to next text box in tab list. When the user types in a
text box and the max length is meet, the focus goes to the next text box in
the tab list. Here is my code so far, but I don't know what to put in the
first parameter of SelectNextControl, noted with a question mark.

class ClassTextBox : System.Windows.Forms.TextBox
{
protected override void OnEnter(System.EventArgs e)
{
base.OnEnter(e);
SelectAll();
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
this.SelectNextControl(?, true, true, true, true);
}
}

Dec 8 '05 #1
3 2504
Mike L,

Just pass this for the first parameter, to start at the current control
(since it is assumed you have focus at that point).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mike L" <Ca***@nospam.nospam> wrote in message
news:95**********************************@microsof t.com...
Custom text box to go to next text box in tab list. When the user types
in a
text box and the max length is meet, the focus goes to the next text box
in
the tab list. Here is my code so far, but I don't know what to put in the
first parameter of SelectNextControl, noted with a question mark.

class ClassTextBox : System.Windows.Forms.TextBox
{
protected override void OnEnter(System.EventArgs e)
{
base.OnEnter(e);
SelectAll();
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
this.SelectNextControl(?, true, true, true, true);
}
}

Dec 8 '05 #2
No errors, but the focus does not go to the next control when the max length
is meet.

class ClassTextBox : System.Windows.Forms.TextBox
{
protected override void OnEnter(System.EventArgs e)
{
base.OnEnter(e);
SelectAll();
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);

if (this.Text.Length == this.MaxLength)
{
this.SelectNextControl(this, false, true, true, true);
}
}
}


"Nicholas Paldino [.NET/C# MVP]" wrote:
Mike L,

Just pass this for the first parameter, to start at the current control
(since it is assumed you have focus at that point).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mike L" <Ca***@nospam.nospam> wrote in message
news:95**********************************@microsof t.com...
Custom text box to go to next text box in tab list. When the user types
in a
text box and the max length is meet, the focus goes to the next text box
in
the tab list. Here is my code so far, but I don't know what to put in the
first parameter of SelectNextControl, noted with a question mark.

class ClassTextBox : System.Windows.Forms.TextBox
{
protected override void OnEnter(System.EventArgs e)
{
base.OnEnter(e);
SelectAll();
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
this.SelectNextControl(?, true, true, true, true);
}
}


Dec 9 '05 #3
Mike L wrote:
No errors, but the focus does not go to the next control when the max length
is meet.

class ClassTextBox : System.Windows.Forms.TextBox
{
protected override void OnEnter(System.EventArgs e)
{
base.OnEnter(e);
SelectAll();
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);

if (this.Text.Length == this.MaxLength)
{
this.SelectNextControl(this, false, true, true, true);
}
}
}


Change your code to
this.FindForm().SelectNextControl(this, false, true, true, true);
--
Tom Porterfield
Dec 9 '05 #4

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

Similar topics

0
by: Mark | last post by:
I need some advice on how to acheive the desired result of my custom page link generation. The datagrid 'built-in' page navigation only allows either the 'Prev/Next' or the page numbers. ...
0
by: Ron Andersen | last post by:
I have C# custom actions and merge modules created in Visual Studio to install some components of the application I am working on. The merge modules are used with an Install Shield 9 project. ...
16
by: Bret Pehrson | last post by:
I've converted a non-trivial C++ library to managed, and get the following unhelpful linker error: Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom attributes are...
0
by: Oded Dror | last post by:
Hi there, I have custom validator base on LUHN (MODE10) function for CCNumber look like this Sub ValidateCCNumber1(ByVal s As Object, ByVal e As ServerValidateEventArgs) Dim intCounter As...
11
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with...
1
by: RSH | last post by:
I am testing a few concepts in preparation of a project. One of the concepts revolves around a custom dropdownlist class. Basically I am overriding the RenderContents and writing a custom value...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
16
by: pupilstuff | last post by:
hi guys i just want to perform custom paging in which at the footer of the grid view ,there must be a pager 'pervious/next with numeric' this is what i did in aspx page <asp:GridView...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
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...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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

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.