Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Programatically creating and fetching controls in TablelayoutPanel in
I have something to share with all.
Tablelayoutpanel can arrange the controls in the cells by defining the column and row number. We can add controls by defining the column and row Number.
Add a TableLayoutPanel control in the form and name it as "TablelayoutPnl".
Dim IDLbl As New Label
IDLbl.Name = "ID"
IDLbl.Size = New System.Drawing.Size(10, 17)
IDLbl.Text = "Test"
Dim IDpos As New TableLayoutPanelCellPosition(0, 0)
Dim NameTxt As New TextBox
NameTxt.Size = New System.Drawing.Size(100, 17)
NameTxt.Text = "Test Data"
Dim NamePos As New TableLayoutPanelCellPosition(1, 0)
Here one label and text box will be created in the first row in the first and second cell respectively.TableLayoutPanelCellPosition takes two parameters column and row. we can increase the row number in a for...loop if we want to create more number of rows