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.
rahul bhosalePosted Dec 31, 2008, 1:20 AM
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..
tommyPosted Dec 30, 2008, 10:34 PM
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;}
}
tommyPosted Dec 30, 2008, 10:10 PM
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?
Jan MontanoPosted Dec 23, 2008, 1:18 AM
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#
tommyPosted Dec 23, 2008, 12:54 AM
yes, I have no idea how to do this in programming...
I'd appreciate if anyone could give me a head start.
Bechir BejaouiPosted Dec 22, 2008, 9:50 AM
tommyPosted Dec 22, 2008, 3:22 AM
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.
Jan MontanoPosted Dec 22, 2008, 3:03 AM
Hi Tommy,
Welcome! Could you rephrase what you want to attain a bit. My brain is very slow today. :)