dynamically created controls

Y

Ying-Shen Yu[MSFT]

Hi Konrad,
I agree with our MVP. You can created the control in run-time like:
<code>
Button btn = new Button();
btn.Bounds = new Rectangle(10,10,100,100);
btn.Text = "ClickMe";
btn.Name = "btnClick";
//the Controls property of the form.
Controls.Add(btn);
</code>

If you still have questions ,please let me know.
Thanks for using MSDN Newsgroup!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

--------------------
| From: "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net>
| References: <[email protected]>
| Subject: Re: dynamically created controls
| Date: Fri, 10 Oct 2003 15:28:14 +0200
| Lines: 28
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: acb31dfe.ipt.aol.com 172.179.29.254
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:54151
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Create the control, set it's properties and add it to the forms Controls
| collection.
|
| --
| Bob Powell [MVP]
| C#, System.Drawing
|
| September's edition of Well Formed is now available.
| http://www.bobpowell.net/currentissue.htm
|
| Answer those GDI+ questions with the GDI+ FAQ
| http://www.bobpowell.net/gdiplus_faq.htm
|
|
|
| | > Hi
| >
| > How to have dynamically created
| > controls visible on the form?
| >
| > Thanks
| > Konrad
| >
| >
|
|
|
 

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