Controls in a different class than my Form

G

gbraux

Hello,

I have created a Forms.Control class that contains a method that
dynamiquely generate buttons (buttons params are arguments of the
method).

I'd like to call this method from my form (Form1), and have the
dynamiquely created button placed on my From1 ...

I tired some ways to have my two class communicating
(ControlCollections ...), but without success ...

Thanks for your help,

Guillaume,
 
M

Morten Wennevik

Hi,

How about

Button b = SomeClass.CreateButton(param1, param2, param2);
this.Controls.Add(b);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top