471,335 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,335 software developers and data experts.

Resize DataGrid Control's columns - VB.NET


My question is if it's possible to adjust DataGrid control's columns' width
by code (runtime).
I have a DataGrid control that displays table from dataset that contains two
fields. The first one is just an ID, which is 4 digits long, while the other
field is a long text field. I don't want the user to change it every time
when the form loads, but do it for him by code.

Any idea will be thankful!
Tom Rahav.
Jul 22 '05 #1
1 3273
Hi Tom,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to control the width of each
column in a DataGrid control. If there is any misunderstanding, please feel
free to let me know.

As far as I know, to control the width of each column, we have to add
TableStyles and GridColumnStyles. We can add a TableStyle for the whole
table and add GridColumnStyles for each column. In the DataGridColumnStyle,
we change the Width property to achieve this.

frlrfsystemwindowsformsdatagridcolumnstyleclasswid thtopic.asp


Kevin Yu
"This posting is provided "AS IS" with no warranties, and confers no

Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jeff | last post: by
3 posts views Thread by Jim Heavey | last post: by
3 posts views Thread by VB Programmer | last post: by
7 posts views Thread by BobAchgill | last post: by
1 post views Thread by Tom Rahav | last post: by
4 posts views Thread by gane | last post: by
4 posts views Thread by tasiekk | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.