Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Create a data table with 3 columns.
Dim dt As DataTable = New DataTable("Table1")
dt.Columns.Add("Col1", GetType(String))
dt.Columns.Add("Col2", GetType(String))
dt.Columns.Add("Col3", GetType(String))
' Fill the data table with some random data.
Dim i As Integer
For i = 0 To 100 - 1
dt.Rows.Add(New String() {"Test" & i + 1, "Test" & i + 2, "Test" & i + 3})
Next
' Set the grid's data source to the data table.
Me.UltraGrid1.DataSource = dt
Dim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands("Table1")
band.Override.RowSpacingAfter = 5
' Turn on the row layout functionality for Table1 band.
band.RowLayoutStyle = RowLayoutStyle.ColumnLayout
' Create a new row layout with "Horizontal" as the key.
Dim horizontalRowLayout As RowLayout = band.RowLayouts.Add("Horizontal")
horizontalRowLayout.ColumnInfos("Col1").Initialize(0, 0, 1, 1)
horizontalRowLayout.ColumnInfos("Col2").Initialize(1, 0, 1, 1)
horizontalRowLayout.ColumnInfos("Col3").Initialize(2, 0, 1, 1)
' Create a new row layout with "Vertical" as the key.
Dim verticalRowLayout As RowLayout = band.RowLayouts.Add("Vertical")
verticalRowLayout.ColumnInfos("Col1").Initialize(0, 0, 1, 1)
verticalRowLayout.ColumnInfos("Col2").Initialize(0, 1, 1, 1)
verticalRowLayout.ColumnInfos("Col3").Initialize(0, 2, 1, 1)
' Load the Vertical row-layout.
band.RowLayouts("Vertical").Apply()
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles checkBox1.CheckedChanged
If Me.CheckBox1.Checked Then
' Load the Horizontal row-layout.
Me.UltraGrid1.DisplayLayout.Bands(0).RowLayouts("Horizontal").Apply()
Else
' Load the Vertical row-layout.
Me.UltraGrid1.DisplayLayout.Bands(0).RowLayouts("Vertical").Apply()
End If
End Sub