Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2004

Tip: Looking for answers? Try searching our database.

Dynamically add controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ryu - 15 Oct 2004 03:10 GMT
Is there a way to dynamically controls like the Placeholder in ASP.Net in a
Window App?
Arne Janning - 15 Oct 2004 03:35 GMT
> 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
Ryu - 15 Oct 2004 03:43 GMT
Thanks!
Ignacio Machin \( .NET/ C#  MVP \) - 15 Oct 2004 15:57 GMT
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,

Signature

Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

> Thanks!
Arne Janning - 15 Oct 2004 16:44 GMT
Hi Ignacio!

"Ignacio Machin ( .NET/ C# MVP )" schrieb
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.