Re: [2.0] TabControl in C#
Why are you adding a tabpage to tabpg then trying to remove it? If you want it hidden, just change it's Visible property to false.
Re: [2.0] TabControl in C#
Quote:
Originally Posted by kasracer
Why are you adding a tabpage to tabpg then trying to remove it? If you want it hidden, just change it's Visible property to false.
Thank you,
Please could you give me the syntax to change the tabcontrol's visible property to false.
Regards
Re: [2.0] TabControl in C#
MyTabControl.Visible = false;
or if you want to make your tabpage invisible
MyTabPage.Visible = false;
Re: [2.0] TabControl in C#
Quote:
Originally Posted by kasracer
MyTabControl.Visible = false;
or if you want to make your tabpage invisible
MyTabPage.Visible = false;
Thank you,
But I see no visible property for my TabPage.
As you already know, I am creating this TabPage Dynamically.
And I want to Hide and Show this Tab.
Thank you
Re: [2.0] TabControl in C#
Oh sorry, I forgot it does not have a Visible property. Use the Hide() and Show() methods.
Re: [2.0] TabControl in C#
Hide and Show don't work with tab pages. If you want a tab page to not be visible then you have to remove it from the tab control. Your immediate problem is this line:
Code:
tabpg = this.tabctrlEmployeeInfo.TabPages.Add("tabpgSalary");
That is trying to assign the result of the Add method to a TabPage variable, but that method doesn't return a TabPage object, or anything else for that matter. I think what you mean is:
Code:
tabpg = this.tabctrlEmployeeInfo.TabPages("tabpgSalary");
without the Add. That will get the TabPage with that name.