Pergunta

I have a windows form in C# project that keeps Student Info. I caught the image: enter image description here

I want to add data with sequential order as follows but when I enter data to Surname textbox, TAB button jumps to E-Mail textbox, then Phone Number textbox and lastly to Date of Birth DateTimePicker.

I made all control's TabStop property "False" on the form except these textboxes. And I arranged their TabOrder via Properties Section as follows 0,1,2.. as I intented. But the order followed as I wrote above. Then I opened Tab Order function via "View" on menu strip.. I clicked all controls which I wanted to use in order, but no use. The form and Tab button act as before. I caught Tab Order function image below:

enter image description here

What shall I do now?

Foi útil?

Solução

TabIndex is important for controls which are siblings of the same parent. However, if your TextBox and ComboBox controls are each inside different parents then their parent controls must have a the proper TabIndex.

In the Windows Forms Designer you can see which controls are children of which panels by bringing up the Document Outline. Go to View -> Other Windows -> Document Outline.

If each TextBox or ComboBox is directly inside a parent then its TabIndex doesn't matter, it can be 0. It's the parent (and possibly the parent's parent's) TabIndex which needs to be in order.

Outras dicas

Now that we have VS 2019. Simply go to form.cs[design], click "View" tab at the top of the page and select "Tab Order". This will allow you to click on the form elements in order of which you want them to be tabbed to. Any items not selected will not be tabbable(I think I made this word up). Once complete, click "Tab Order" again to exit view.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top