468,766 Members | 1,295 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,766 developers. It's quick & easy.

autosize DataGrid column

I'm using Visual Studio 2003. Is there a way one can cause columns in a
DataGrid to autosize? Also, is there a way to cause the last column to take
up the remaining space between the end of the column and the right edge of
the DataGrid? And finally, is there a way to remove the row that permits a
user to add data? I looked in the Help, but was unable to discern the
answers to the aforementioned questions.

Tim
Nov 17 '05 #1
2 3610
Tim,

I don't think there is a way to perform the sizing operations you
specified. If anything, you would have to perform all of the calculations
yourself, and then apply it to the size.

As for removing the final row that permists a user to add data, bind to
a DataView on your table, setting the AllowNew property on the view to
false.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message
news:Ou**************@TK2MSFTNGP12.phx.gbl...
I'm using Visual Studio 2003. Is there a way one can cause columns in a
DataGrid to autosize? Also, is there a way to cause the last column to
take up the remaining space between the end of the column and the right
edge of the DataGrid? And finally, is there a way to remove the row that
permits a user to add data? I looked in the Help, but was unable to
discern the answers to the aforementioned questions.

Tim

Nov 17 '05 #2
There's nothing build into the .Net Framework which does the Auto-size.
However, there was an article about in of CodeProject.com some time ago.

--
--
Truth,
James Curran
[erstwhile VC++ MVP]

Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com

"Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message
news:Ou**************@TK2MSFTNGP12.phx.gbl...
I'm using Visual Studio 2003. Is there a way one can cause columns in a
DataGrid to autosize? Also, is there a way to cause the last column to take up the remaining space between the end of the column and the right edge of
the DataGrid? And finally, is there a way to remove the row that permits a user to add data? I looked in the Help, but was unable to discern the
answers to the aforementioned questions.

Tim

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by | last post: by
1 post views Thread by Cybertof | last post: by
2 posts views Thread by CSL | last post: by
1 post views Thread by Silvia | last post: by
9 posts views Thread by Kevin Westhead | last post: by
1 post views Thread by Gunjan Shah | last post: by
8 posts views Thread by Jordi Rico | last post: by
1 post views Thread by SAL | last post: by
2 posts views Thread by =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.