Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics
Private Sub Button14_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button14.Click
Dim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands(0)
' Check if the column has already been added.
If Not band.Columns.Exists("UBColumn1") Then
' Add an unbound column with the key of "UBColumn1"
band.Columns.Add("UBColumn1")
band.Columns("UBColumn1").DataType = GetType(String)
End If
' Loop through all the columns and print out the keys of the columns that are
' unbound. There will be only one such column since we've added only one unbound
' column above.
Dim i As Integer
For i = 0 To band.Columns.Count - 1
' IsBound indicates whether a column is a bound column or is an unbound column.
If Not band.Columns(i).IsBound Then
Debug.WriteLine(band.Columns(i).Key & " is an unbound column")
Else
' Each bound column has a PropertyDescriptor associated with it. PropertyDescriptor is
' associated with a column or field in the underlying data structure. The UltraGrid
' gets property descriptors through BindingManagerBase.GetItemProperties method.
Dim pd As System.ComponentModel.PropertyDescriptor = band.Columns(i).PropertyDescriptor
Debug.WriteLine(band.Columns(i).Key & " is a bound column. Property descriptor info: Name = " & pd.Name & ", Type = " & pd.PropertyType.Name)
End If
Next
End Sub