Set a tab page on lload event of a form

Posted by tanu on Stack Overflow See other posts from Stack Overflow or by tanu
Published on 2013-10-23T15:40:29Z Indexed on 2013/10/23 15:53 UTC
Read the original article Hit count: 131

Filed under:

i have a form with many tabs on it. I want to set a specific tab page to show on load of the form everytime i load the form

I used TabPageControl1.SelectedTab=MyTabPage; but the value of selectedtab is null. It is throwing an exception that reference not set to an object.

private void PreferencesForm_Load(object sender, EventArgs e)
    {
        this.cbxCustomDataType.DrawMode = DrawMode.OwnerDrawFixed;
        this.cbxCustomDataType.DrawItem += new DrawItemEventHandler(cbxCustomDataType_DrawItem);

        this.cbxColumnDataType.DrawMode = DrawMode.OwnerDrawFixed;
        this.cbxColumnDataType.DrawItem += new DrawItemEventHandler(cbxColumnDataType_DrawItem);
        GetProjectDetails();
       this.preferencesTabControl.SelectedTab= tpCompareUpdate;

    }

© Stack Overflow or respective owner

Related posts about c#