Hi there,
I am trying to figure out how to get a datagrid control to resize when someone enlarges the form that is is on? I would assume this is fairly easy but I can't seem to see it? Hmm...
Thanks
Printable View
Hi there,
I am trying to figure out how to get a datagrid control to resize when someone enlarges the form that is is on? I would assume this is fairly easy but I can't seem to see it? Hmm...
Thanks
Well, I don't know much about datagrids but you'd probably put the code to resize the grid into the form's Resize event procedure. The obvious method would be to set the grid's Height & Width properties to some fraction of the form's but there might be an easier way. (Even more so if you're dealing with multiple controls as you'd probably need to reposition them, too.)
Try setting the anchors for the control. If you want it to resize in all directions then turn on all anchors, this will make it change with the size of the form. Or there is always docking if you just want it to fill the form.
On the form resize
VB Code:
dgvResults.Size = New Size(Me.Width, Me.Height)
Ahh, thanks much all, anchors are the trick!!!