Live Chat Icon For mobile
Live Chat Icon

The controls that I’ve try to add to my form at runtime don’t show up. What’s wrong

Platform: WinForms| Category: Form

Make sure you implemented and executed code similar to the InitializeComponent method that VS adds to your Windows Forms project for controls added during design time. Recall that InitializeComponent() is called from your Forms constructor to create the controls, size, position and show the controls, and finally add the controls to the form’s Controls collection. So, your code at runtime should also implement these same steps. In particular, don’t forget the this.Controls.AddRange call that adds your new controls to the form’s Controls collection.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.