How to resize column width of datagrid.
-
Hello, I am using datagrid to show my records. now column width is set by default. which could be resized but that doesn't look good presentation. so can anybody tell me how can I resize my datagrid column width. Thank you For ur support. Inpreet Singh
-
Hello, I am using datagrid to show my records. now column width is set by default. which could be resized but that doesn't look good presentation. so can anybody tell me how can I resize my datagrid column width. Thank you For ur support. Inpreet Singh
-
Hello, I am using datagrid to show my records. now column width is set by default. which could be resized but that doesn't look good presentation. so can anybody tell me how can I resize my datagrid column width. Thank you For ur support. Inpreet Singh
See the DataGrid.TableStyles Property[^] documentation in the .NET Framework SDK for a detailed review of how to explicitly define table and column styles. For instance, if you use a
DataSet
(and assign theDataGrid.DataMember
to the appropriate table name within theDataSet
) orDataTable
for theDataGrid.DataSource
property, you create a newDataGridTableStyle
with theMappingName
set to the table (you can also set it to specially formatted names for non-DataSet
data sources, but see the documentation for more information). You then addDataGridColumnStyle
s to the table style that map to your column names. You can specify captions, column widths, string formats (for numbers, dates, etc.), and more. You can also define your own. The VS.NETDataGrid
designer also does a great job of helping you if you assign yourDataSet
at design-time to theDataGrid.DataSource
(using theDataSet
to create an instance of some strongly-typedDataSet
defined in your current or dependent project). Even without, click on the "..." button next to theTableStyles
property and explore.Microsoft MVP, Visual C# My Articles