We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Platform : Windows Forms
|
Category : Controls

How can I add a control to a Window Form at runtime

To add a control at runtime, you do three steps:
  • 1. Create the control
  • 2. Set control properties
  • 3. Add the control to the Form’s Controls collection

In general, if you need help on exactly what code you need to add, just look at the code generated by the designer when you add the control at design time. You can generally use the same code at runtime.

Here are code snippets that create a textBox at runtime.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.