Replacing one tab with another

  • Thread starter Thread starter Aaron Queenan
  • Start date Start date
A

Aaron Queenan

I have a dialogue box with two tabs. When the user clicks the "Advanced"
button on the tab, I want to replace the selected tab with an "Advanced" tab
which is completely different. I don't want the "Advanced" tab and the
"Simple" tab showing at the same time.

I've tried using TabControl.Hide(), but that seems to only affect the
controls on the tab, it doesn't effect the tabs shown at the top. If I
remove the old tab and insert a new one, is there any way to move the new
tab to the same position as the old one?

Is there any way to replace one tab with another or to hide and show the tab
as required?

Thanks,
Aaron Queenan.
 
Aaron,

int index = tabMain.TabPages.IndexOf(tabOld);
tabMain.TabPages.Remove(tabOld);
tabMain.TabPages.Insert(index,tabNew);

Hope this helps.

Durand
 
I've just tried that, but the compiler complains that TabPages doesn't have
an Insert method. Any other hints?

Thanks,
Aaron Queenan.
 
Hi Aaron,

Aaron Queenan said:
I have a dialogue box with two tabs. When the user clicks the "Advanced"
button on the tab, I want to replace the selected tab with an "Advanced" tab
which is completely different. I don't want the "Advanced" tab and the
"Simple" tab showing at the same time.

I've tried using TabControl.Hide(), but that seems to only affect the
controls on the tab, it doesn't effect the tabs shown at the top. If I
remove the old tab and insert a new one, is there any way to move the new
tab to the same position as the old one?

Is there any way to replace one tab with another or to hide and show the tab
as required?

Perhaps you could put the "simple" controls and the "advanced" controls
in two seperate panels on the same tab. Hide/show each panel as appropriate.

Regards,
Dan
 
Back
Top