Dynamically add controls

  • Thread starter Thread starter Ryu
  • Start date Start date
Ryu said:
Is there a way to dynamically controls like the Placeholder in ASP.Net in
a Window App?

System.Windows.Forms.Panel is a "placeholder"-control.

Adding controls is trivial:

Panel pnl = new Panel();
//set width, height, position, etc left out here

myForm.Controls.Add(pnl)

Button btn = new Button()
//set width, height, position, etc left out here

pnl.Controls.Add(btn)

Cheers

Arne Janning
 
Hi,

Just remember that you have to recreate the controls in the postback if you
want to be able to access them in the page.

Cheers,
 
Hi Ignacio!

Just remember that you have to recreate the controls in the postback if
you
want to be able to access them in the page.

we were talking about Windows.Forms!

Cheers

Arne Janning
 
Back
Top