Hi,

I am using VS C++ 2005 express edition. I developed a simple GUI with a single tabControl (contain tabpages with some combobox).

I wish to add a button which able to add another tabpage which contain the same item as previous tabpages.

For example. my previous tabpage contain 2 combobox and 1 button. Now with a single button click I wish to add a new tabpage , then it will pop out a dialog box and prompt user to key in the name of the new tabpage, the items in the new tabpage is same as previous.

Can any pro fren show me the function to code it? Thanks in advance.

Regards,

Adrian

>Can any pro fren show me the function to code it?
I imagine it would be something like this:

void button_Click ( Object^, System::EventArgs^ )
{
  tabControl->TabPages->Add ( gcnew TabPage ( "Dynamic Tab" ) );
}

Hi,

Thanks for reply, but the code you provided is juz add a new tabpage. I wish to create a new tabpage which have the same item as other tabpage.

Pls lend me some help....

Regards,
Adrian

I'd create a custom control that embeds all of the controls and functionality you currently have. Then you can easily add a new instance of the custom control to the new tab page's Controls list. Otherwise, you'll have to copy all of the controls on one of the old tab pages manually to the new tab page. Depending on the complexity of each page, this could be very tedious.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.