Hi,
I'm quite fresh in programming and recently picking up visual C#.
Recently I'm trying to make an application of "Cars" of which there's 3 sub menus which I place them under 3 tab page respectively.
But now i want to add in another type "Engine" into the application, I have added in 2 buttons for navigation use but there's only 2 sub menus under "Engine" and the details inside are different for both of them, how do i make the tabpages in this case?
Thank you for any help in advance.

Jan MontanoRank #1,295 · 1.3K reputationPosted Dec 21, 2008, 10:03 PM EST
Hi Tommy,
Welcome! Could you rephrase what you want to attain a bit. My brain is very slow today. :)
tommy32 reputationPosted Dec 21, 2008, 10:22 PM EST
Sorry if my description is confusing.
In short I'm trying to attain an application with 2 menus. Cars and Engines. Under "Cars" there's 3 tabpages but for "Engines" there's only 2 tabpages.
Bechir BejaouiRank #144 · 15.9K reputationPosted Dec 22, 2008, 4:50 AM EST
tommy32 reputationPosted Dec 22, 2008, 7:54 PM EST
yes, I have no idea how to do this in programming...
I'd appreciate if anyone could give me a head start.
Jan MontanoRank #1,295 · 1.3K reputationPosted Dec 22, 2008, 8:18 PM EST
private void button1_Click(object sender, EventArgs e)
{
tabControl1.TabPages.Add("Engine1", "Engine Sub Menu 1");
}
private void button2_Click(object sender, EventArgs e)
{
tabControl1.TabPages.Add("Engine2", "Engine Sub Menu 2");
}
For additional info try, read this article by Mahesh: Working with Windows TabControl with C#
tommy32 reputationPosted Dec 30, 2008, 5:10 PM EST
I tried putting 2 buttons and splitted the tabpage code to the individual buttons so when ever I click the specfic button it would generate the tabpages to that button.
But the problem is every time i click the same button it keeps on adding the tabpages, is there a refresh function to refresh the tabcontrol?
tommy32 reputationPosted Dec 30, 2008, 5:34 PM EST
got help from another forum's mod by adding this to where the tabpage genertate seems to solve the problem.(my 1st tab page is named "abc")
string tag = "abc";
foreach (TabPage page in tabControl1.TabPages)
{
if (page.Text == tag){return;}
}
rahul bhosale15 reputationPosted Dec 30, 2008, 8:20 PM EST
hi,
If u r implementing tabcontrol dynamically, then every time on buttin click u need to create new one...
If its static means u have designed tabcontrols for both buttons seperately.. then u can toggle them with visible attribute...
thank u..