Dynamically add controls

  • Thread starter Thread starter Ryu
  • Start date Start date
R

Ryu

Is there a way to dynamically controls like the Placeholder in ASP.Net in a
Window App?
 
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
 

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

Back
Top