Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15475

How to iterate rows and columns in TableLayoutPanel

$
0
0
I am trying to add a TableLayoutPanel to my form at runtime. I have the following code which works (suggestions for improvements are welcome.)

Code:

  Dim myTable As New TableLayoutPanel
        myTable.Name = "myTable1"
        myTable.RowCount = 10
        myTable.ColumnCount = 10

        myTable.CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset

        myTable.Location = New Point(100, 100)

        Controls.Add(myTable)

What I cannot figure out is how to set the row heights and column widths. I think it needs some form of FOR EACH loop but I cannot find the right code to reference the rows and columns. I have tried this code:
Code:

  myTable.RowStyles.Add(New RowStyle(SizeType.Absolute, 30))
but it only affects the first row and I can't find any way to index it.

Any help will be appreciated. And btw - once I get this, I will need to address each of the cells individually.

Thanks

Viewing all articles
Browse latest Browse all 15475

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>