Expanding column width in a Datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi;

What is the correct way to expand a column width to display data bound to it ?

Is it merely setting the control.width property ?

Thanks
 
Dim DataGridTableStyle1 As New System.Windows.Forms.DataGridTableStyle

Dim DataGridTextBoxColumn1 As New
System.Windows.Forms.DataGridTextBoxColumn
Dim DataGridTextBoxColumn2 As New
System.Windows.Forms.DataGridTextBoxColumn

DataGridTextBoxColumn1.Width = 200
DataGridTextBoxColumn2.Width = 50

DataGrid1.TableStyles.AddRange(New
System.Windows.Forms.DataGridTableStyle() {DataGridTableStyle1})

Watch the word wrap on that last one. You can do this in the designer
as well, by clicking in the properties window of the datagrid. Check
out the TableStyles Property. Add a TableStyle to the Grid using the
designer, and in the TableStyle selection screen, you can add
ColumnStyles to the TableStyle.
 
Back
Top