Adding objects to a tabpage programmitically 
Author Message
 Adding objects to a tabpage programmitically

Hi,

How can I programmitically add objects (i.e. buttons, labels) to particular
tabpages in runtime. How can specify which button belongs to to which
tabpage?

Thanks in advance,

Randy F.



Tue, 17 May 2005 00:45:36 GMT  
 Adding objects to a tabpage programmitically
I think what you are referring to is the Parent property on the object.

so if want new button on TabPage1

Button myBtn = new Button();

myBtn.Parent = TabPage1;

Think this workds.. but untested code, and a newbie to C#


Quote:
> Hi,

> How can I programmitically add objects (i.e. buttons, labels) to
particular
> tabpages in runtime. How can specify which button belongs to to which
> tabpage?

> Thanks in advance,

> Randy F.



Tue, 17 May 2005 00:48:52 GMT  
 Adding objects to a tabpage programmitically
This is the way I do it... BTW ... if you have Visual Studio, use the Visual
Form Designer to create a form and then look at the code that is
automatically generated. All will be revealed.

this.txtBox = new System.Windows.Forms.TextBox(); // create a new Text box
this.txtBox.BorderStyle = System.Windows.Forms.BorderStyle.None;   // set
some properties
// yada, yada, yada -  set more properties and then when you are ready...
this.tabPage.Controls.AddRange(new System.Windows.Forms.Control[]
{this..txtBox}); // add it to whichever tabPage you like

Best Regards,
John Saxton


if you want to contact me direct... hopefully spam trollers can't


Quote:
> Hi,

> How can I programmitically add objects (i.e. buttons, labels) to
particular
> tabpages in runtime. How can specify which button belongs to to which
> tabpage?

> Thanks in advance,

> Randy F.



Tue, 17 May 2005 05:56:57 GMT  
 Adding objects to a tabpage programmitically
Thank you very much, I got it working...

Randy F.


Quote:
> Hi,

> How can I programmitically add objects (i.e. buttons, labels) to
particular
> tabpages in runtime. How can specify which button belongs to to which
> tabpage?

> Thanks in advance,

> Randy F.



Tue, 17 May 2005 21:46:51 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. dynamically adding separately created tabpage to tabcontrol

2. Programmitically Send FIle(s) via InfraRed?

3. Adding ptr to an object to an existing array of objects

4. TabPage question

5. How to display richtextbox scrollbars on a tabpage?

6. Newbit: help with TabPage and Controls

7. TabControl tabpage change

8. Catching the TabPage change event?

9. Broken Show() and Hide() for Forms.Form.TabPage

10. Hide a TabPage

11. is it possible to show Form on TabPage ?

12. TabPage - OnChange

 

 
Powered by phpBB® Forum Software