471,605 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Programatically Set The Width of a column in a datagrid.

UJ
How can I set the width of a column in a datagrid? I'm creating a new table,
defining the columns then tying it to a datagrid and want to make the column
wider than the default (the default value is cutting off some of a string.)

TIA - Jeff.
Feb 3 '06 #1
2 1395
theBoundColumn.ItemStyle.Width = "500";

hope thats what your lookin for.

sean
Feb 3 '06 #2
Hi UJ,
if you want to have the columns auto adjust instead of setting them to a
fixed width then you can set the DataGridViews AutoSizeColumnsMode. The
columns will then autosize depending on the size of the data in them.

Hope that helps
Mark Dawson
http://www.markdawson.org

"UJ" wrote:
How can I set the width of a column in a datagrid? I'm creating a new table,
defining the columns then tying it to a datagrid and want to make the column
wider than the default (the default value is cutting off some of a string.)

TIA - Jeff.

Feb 4 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Prateek | last post: by
9 posts views Thread by web1110 | last post: by
24 posts views Thread by Mike L | last post: by
reply views Thread by Dan Hartshorn | last post: by
reply views Thread by CCCYYYY | 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.