By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,672 Members | 1,304 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,672 IT Pros & Developers. It's quick & easy.

Dynamic Contorls & Classes

P: n/a
Hiya All,

I'm coding in C#, & making a windows application. I am trying to figure out
how to put my dynamic control code in a seperate class (say ie
ButtonClass.cs) so that I can re-use the code with in multiple forms
(ie.frmOne, frmTwo). Being a newbie, I'm not sure if I should try my hand at
Interface class or what to do here.

Could anyone out there please give me advice on how to do this, what is
needed and or better yet, a simple sample. Say adding dynamic button or
textbox to a form.

Thank you all in advance.

MikeY

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
MikeY,

All you really have to do is call the Add method on the Controls
property that the form exposes. You would pass in the control that you want
to add to the form, and the control's Location and Size properties will
dictate the size and the location of the control on the form.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"MikeY" <mi*******@yahoo.ca> wrote in message
news:uB**************@TK2MSFTNGP10.phx.gbl...
Hiya All,

I'm coding in C#, & making a windows application. I am trying to figure out how to put my dynamic control code in a seperate class (say ie
ButtonClass.cs) so that I can re-use the code with in multiple forms
(ie.frmOne, frmTwo). Being a newbie, I'm not sure if I should try my hand at Interface class or what to do here.

Could anyone out there please give me advice on how to do this, what is
needed and or better yet, a simple sample. Say adding dynamic button or
textbox to a form.

Thank you all in advance.

MikeY

Nov 13 '05 #2

P: n/a
Thanks Nicholas. Much appreciated

MikeY

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:O4**************@TK2MSFTNGP11.phx.gbl...
MikeY,

All you really have to do is call the Add method on the Controls
property that the form exposes. You would pass in the control that you want to add to the form, and the control's Location and Size properties will
dictate the size and the location of the control on the form.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"MikeY" <mi*******@yahoo.ca> wrote in message
news:uB**************@TK2MSFTNGP10.phx.gbl...
Hiya All,

I'm coding in C#, & making a windows application. I am trying to figure out
how to put my dynamic control code in a seperate class (say ie
ButtonClass.cs) so that I can re-use the code with in multiple forms
(ie.frmOne, frmTwo). Being a newbie, I'm not sure if I should try my

hand at
Interface class or what to do here.

Could anyone out there please give me advice on how to do this, what is
needed and or better yet, a simple sample. Say adding dynamic button or
textbox to a form.

Thank you all in advance.

MikeY


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.