|
-
Feb 16th, 2007, 01:37 PM
#1
Thread Starter
Hyperactive Member
Getting datagrid controls to resize automatically
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
-
Feb 16th, 2007, 01:45 PM
#2
Hyperactive Member
Re: Getting datagrid controls to resize automatically
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.)
-
Feb 16th, 2007, 02:47 PM
#3
Re: Getting datagrid controls to resize automatically
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.
-
Feb 16th, 2007, 03:32 PM
#4
Addicted Member
Re: Getting datagrid controls to resize automatically
On the form resize
VB Code:
dgvResults.Size = New Size(Me.Width, Me.Height)
-
Feb 16th, 2007, 04:08 PM
#5
Thread Starter
Hyperactive Member
Re: Getting datagrid controls to resize automatically
Ahh, thanks much all, anchors are the trick!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|