what container should I use for a four column form

David_Ford

Member
Joined
May 11, 2016
Messages
10
Programming Experience
10+
I want to design a form with four columns.

First column will be a table container, with labels and textboxes, vertically arranged.
Second column will be a datagridview to a linked table.
Third column will be another datagridview, to another linked table.
Fourth column will be a copy of the first column.

The first column will show the details from a row in the datagrid in the second column.
The last column will show the details from a row in the datagrid in the third column.

I would like to control the widths of the columns. I would like things to expand with the size for the form. If the form is made smaller, I don't want any columns hiding behind another column (which I have now).

Which container control should I use, and how should I design the splits?

Thanks.
 
It sounds like you should be using a TableLayoutPanel as the root for your layout. You can add four columns to the table and you can also add rows if you like, in which case you'd probably have the grids spanning multiple rows. You can set percentages for the column widths and then, as the table's width grows and shrinks, the widths of the columns will change to maintain the proportions. You can even set some widths to be absolute and some proportional if you want. Note that you'll want to set the Dock and/or Anchor properties of the TableLayoutPanel to have it resize with the form and then do the same for the child controls.
 
It sounds like you should be using a TableLayoutPanel as the root for your layout. You can add four columns to the table and you can also add rows if you like, in which case you'd probably have the grids spanning multiple rows. You can set percentages for the column widths and then, as the table's width grows and shrinks, the widths of the columns will change to maintain the proportions. You can even set some widths to be absolute and some proportional if you want. Note that you'll want to set the Dock and/or Anchor properties of the TableLayoutPanel to have it resize with the form and then do the same for the child controls.

Thanks. I'm fooling with that (found the columns collection and setting stuff in there), but, it is not resizing to the form. And when I set anchor to all 4 sides, instead of just top and left, I get this error message:

"Property value is not valid."

"The file C:\Users\Davie\Documents\Visual Studio 2015\Projects\Addresses\Addresses\Form1.vb cannot be modified in the designer while building or debugging."

Autosize mode is set to Grow and Shrink for the outer tablelayout panel.

Now, what I have set up is a table layout panel with 4 columns, and in the 1st and 4th columns, I have a table layout panel within the column, so I can have my fields and labels showing vertically.
Autosize mode is set to Grow and Shrink for the outer tablelayout panel.

CObMAAAAASUVORK5CYII=
 

Attachments

  • screenshot.png
    screenshot.png
    40.9 KB · Views: 44
Back
Top