AS
Arun Srinivasan
Syncfusion Team
November 3, 2003 08:25 PM UTC
Hi Otis,
Kindly take a look at the XPTabs sample located in the Syncfusion\Essential Suite\Tools\samples\Tabs Package\XPTabs directory.
Take a look at the code in Form2_InitProgramatically() which demonstrates how you can create and add tabs using code.
Modify the Application's Run() to:
Application.Run(new Form2_InitProgramatically());
Does this take care of what you are looking for?
Regards,
Arun
OW
Odis Wooten
November 4, 2003 12:50 PM UTC
Thanks for your prompt reply.
The example using Form2_InitProgramatically() is not what I want to do. I want to be able to create a form using VS.NET designer and then use that form as a tabpage. I don’t want to have to add the control on the tabpage programmatically. The example AdvancedTabbedMDI does this with a TabbedMDI.
I'm need to place this same form as N number of TabPageExt on the TabControlExt.
AS
Arun Srinivasan
Syncfusion Team
November 5, 2003 12:02 PM UTC
Hi Odis
Here is a code snippet that does what you are looking for:
//Form2
Form2 frm2 = new Form2();
frm2.TopLevel = false;
//New Tab
TabPageExt newtab = newTabPageExt("test");
this.tabControlExt1.Controls.Add(newtab);
//Set Form2's parent to be the new tab
frm2.Parent = newtab;
frm2.Visible = true;
frm2.Dock = DockStyle.Fill;
Hope this takes care of this issue.
Regards
Arun
OW
Odis Wooten
November 5, 2003 10:36 PM UTC
Arun
I’m having problems with the code snippet. What class is Form2.
The windows Form class doesn’t have the properties you are using
Frm2.TopLevel = false;
//Set Form2's parent to be the new tab
frm2.Parent = newtab;
frm2.Visible = true;
frm2.Dock = DockStyle.Fill;
Just try to add a simple Form to the XPTab example and then add it to the TabControlExt as a new page.
Odis
AS
Arun Srinivasan
Syncfusion Team
November 6, 2003 11:07 AM UTC
Hi Odis,
I am uploading a small sample that does what you are looking for. Form1 has a TabControlAdv with 2 tabs. Form2 is another form in the project.
When you click the "Create New Tab and add Form 2" button, a new Tab called "FORM_2" is added to the TabControlAdv with Form2 attached to this Tab.
Kindly take a look at the underlying code in the button's click event.
Regards
Arun
OW
Odis Wooten
November 6, 2003 12:24 PM UTC
Arun
Thanks. It works like a charm.
Oids