Jump to content
  • Advertisement
Sign in to follow this  
grizzlebee

[.net] VB .NET datagrid problem

This topic is 3544 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
the datagrid control has the following property

AutoSizeColumnsMode

set this equal to FILL

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!