I am trying to add a bunch of controls dynamically in rows and columns in a Windows Forms form. For example, if I have 20 controls and I need to create three columns and n rows. How do I achieve this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Add a
TableLayoutPanelto your form. At runtime, instantiate your controls using thenewkeyword. Add them to thetableLayoutPanel.Controlscollection. You can either add them to specific rows and columns, or let panel have them flow into the next available cell.