Increase length of datagrid as form length increases

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.
 
R

Rob Oldfield

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top