Increase length of datagrid as form length increases

  • Thread starter Thread starter max.sofia
  • Start date Start date
M

max.sofia

I am about to do what I thought was a simple task. I have a datagrid
in a form. When I increase the height of my form when running the
application I want the datagrid to increase aswell. How do I do it? I
cannot seem to increase my datagrid at all when running the app.
 
I am about to do what I thought was a simple task. I have a datagrid
in a form. When I increase the height of my form when running the
application I want the datagrid to increase aswell. How do I do it? I
cannot seem to increase my datagrid at all when running the app.

Play with either the dock or anchor properties of the datagrid.

Setting the anchor to something like both top and bottom will keep the same
distance between the top/bottom of the form as it resizes.

My preferred solution though would be to use panels and dock settings. Try
this:

Add a panel to a form and set it's dock property to bottom. Add a splitter
to the form and also set it to dock bottom (that should mean that it lies
across the top of the first panel). Add another panel in the top of the form
and set that to dock full (so it takes up the remaining space). Add a
datagrid into the middle of the top panel and set that to dock full as well.
See how that works for you.
 
Back
Top