Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tabbing in a loop through a winform

I have an application where I have several forms. Its a C# windows-form based application build in .NET 4.O. I have several forms where the user enters the data. There are grids where data is displayed and whole lots of controls on the form. Believe me! its a mess of so many controls. I have to setup the TabIndex for each control. I have literally disabled the TabStop property of certain controls I don't want to be tabed into it. However, still once I go through the order I want, I TAB it, and it works but once it reaches the last box then it takes 3-4 times more tabbing to get to the first field. I tried disabling the TabStop property for the controls I don't want. But I think there might be certain controls that I don't see but they might be included in the Tab property. My question is that is there any way that I can set the TabStop property of all the controls on the winform to false and then set it to true for the controls I want to include only.

I also open to if there is any other way I can implement this?

If further explanation is needed, let me know!

I have attached a picture thats the order I want and then loop back but somehow its not working. Just in addition there is also two panels in the form and I have disabled their TabStop property to False. enter image description here

like image 305
C_sharp Avatar asked Jul 24 '26 23:07

C_sharp


2 Answers

  1. Go to View menu and click Tab Order. This will activate the tab-order selection mode on the form. TabIndex value will be displayed as a number on each control.
  2. Click on controls in order you need them to be tabbed. This will set appropriate values for TabIndex of controls.
  3. After you finished, go to View menu and turn-off Tab Order.
  4. Select controls you don't want to be tabbed and set TabStop = false.
like image 143
Sergey Berezovskiy Avatar answered Jul 27 '26 13:07

Sergey Berezovskiy


One simple explanation is that you lost a control underneath another one that overlaps it. Or it is located beyond the edges of the Form. A good tool to find it back is View + Other Windows + Document Outline.

If that doesn't help then diagnose it by adding a Label and a Timer. Write the Tick event handler like this:

private void timer1_Tick(object sender, EventArgs e) {
    if (this.ActiveControl != null) label1.Text = this.ActiveControl.Name;
}
like image 27
Hans Passant Avatar answered Jul 27 '26 12:07

Hans Passant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!