Hi all
I want to set my data grid column width separate for each column. Can it is possible?
I tried as follows...
gridMatchedDB.PreferredColumnWidth = 100
But its setting width to each column. How to set individually ???
Hi all
I want to set my data grid column width separate for each column. Can it is possible?
I tried as follows...
gridMatchedDB.PreferredColumnWidth = 100
But its setting width to each column. How to set individually ???
try this:
gridMatchedDB.Columns(0).Width = 10
gridMatchedDB.Columns(1).Width = 80
This should change the width of the first column to 10 en the second to 80
Hi
Are you using DataTable to Display values in DataGrid?
If so try with the following DataGridTableStyle property
Dim l_dgtsl As DataGridTableStyle
Try
l_dgtsl = New DataGridTableStyle
l_dgtsl.MappingName = DataTableName
Dim l_dglnkCol As DataGridTextBoxColumn
l_dglnkCol = New DataGridTextBoxColumn
l_dglnkCol.MappingName = "Name" 'Column name in the data table
l_dglnkCol.HeaderText = "Name" 'Display name in the grid header
l_dglnkCol.Width = 60 'Preferred width
l_dgtsl.GridColumnStyles.Add(l_dglnkCol)
DataGrid1.TableStyles.Clear()
DataGrid1.TableStyles.Add(l_dgtsl)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.