Skip to main content
GameDev.net gamedev.net
🔒 Locked

[.net] VB .NET datagrid problem

Started by grizzlebee Mar 28, 2006 at 3:18 PM 3 replies 2.2k views
Original Post
grizzlebee
grizzlebee
Hi, I made a datagrid control in VB.NET for my app. When I populate the datagrid with my data I want the data to be the width of the datagrid and its not. I took a screenshot to show what I mean. This is most liked an easy problem but im probable looking past it. Picture I just want when the datagrid is drawn for it to stretch the data to the other edge. Anyone able to help. Thank you much.
alexmoura
alexmoura
I'm not sure if I understand what you mean - if you mean that you want the grid to be of whatever size the containing area is, you need to dock it:

On the form designer, select the grid, and find the "Anchor" property on the properties window - click on the value, then click the dropdown simbol, and select the right side


Then if you resize the form the grid expands with it.

If you want to make the individual columns as wide as the data inside them, then that's (a lot) more complex - I think you'll have to figure out what's the widest data entry for each column, taking into account the font used, etc, and then resize each column accordingly.

You may also want to post that question on one the microsoft vb forums
grizzlebee
grizzlebee
I had tried that and it didnt seem to work. I only have a few columns so maybe the sum of their widths isnt the width of the control. I suppose I will have to try and make the column width so the sum is the width of the control. Thanks for the feedback :P

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.