Say I'm extending a TextBox called CustomTextBox in .net. In certain situations I would like to force a tab to the next TabIndex on the form. Is there a way to do this beyond getting all the controls contained in CustomTextBox's parent, sorting them by their TabIndex, and then focusing the next ordinal one?
+7
A:
I think you are looking for something like the following method:
form1.SelectNextControl(textBox1, true, true, true, true);
(All the trues are just different options, read the intellisense!)
You did say it is WinForms and not WebForms right?
Hope that helps!
Zachary Yates
2008-11-26 18:54:03
A:
If you're extending a normal Winforms Textbox, you can set the AcceptsTab property to True or False, depending on your needs. If it's true, then a tab character will be inserted into your textbox. If it's false, then hitting the Tab key will move focus to the next control in the Tab Order
AR
2008-11-26 18:54:38
I think EMaddox84 meant how does he 'programmatically' force a tab, not how does he set up his controls to accept tabs.
Zachary Yates
2008-11-26 18:56:09