Version

Assign Specific Widths to Columns

Occasionally, you may want to assign specific widths to your WinGrid™ columns. To do this, you can use the Width property of the Column object. The following code should be placed in the InitializeLayout event. The following example code loops through all the columns in the Band and sets their Width to 100.

In Visual Basic:

Imports Infragistics.Win.UltraWinGrid
...
Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, _
  ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) _
  Handles UltraGrid1.InitializeLayout
	Dim oCol As UltraGridColumn
	For Each oCol In e.Layout.Bands(0).Columns
		oCol.Width = 100
	Next
End Sub

In C#:

using Infragistics.Win.UltraWinGrid;
...
private void ultraGrid1_InitializeLayout(object sender,
  Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
	foreach ( UltraGridColumn column in e.Layout.Bands[0].Columns )
	{
		column.Width = 100;
	}
}