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

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!



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

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

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
File Name Size
There are currently no files uploaded.
Maximum number of files 5, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json mixin.theme