Designer sometime add 'SelectedIndex = 0' to the code let to ArgumentOutOfRangeException because no TabPage is added to the TabControl.

0
0

Hi,

 

As title, I have a TabControl that does not have any TabPage. By design, TabPages were added to it at runtime by user actions.

However, the Designer will sometimes add a code like this:

this.tabControl1.SelectedIndex = 0;

Since there is no TabPage in this TabControl, the SelectedIndex 0 means the first TabPage and therefore it caused a ArgumentOutOfRangeException at runtime.

I can (and have) remove this line of code from the Form1.Designer.cs file manually, but the Designer will add it back for me some time later. So, hope it can be solved.

 

Thanks and regards,

Felix CHAN

  • You must to post comments
0
0

Hi Felix,

TabControl,SelectedIndex should not get serialized at all. I have logged WJ-8157 for it.

We´ll inform you when it´s fixed.

Best regards
Frank

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.