I have bound a collection to ultracombo
and I have specified the value member
and display member
. The collections have many columns, N
Here is an extension method that will hide all columns besides the DisplayMember
column.
Public Sub ShowOnlyDisplayMemberColumn(this As UltraCombo)
Dim columnName As String = this.DisplayMember
For Each band As UltraGridBand In this.DisplayLayout.Bands
For i As Integer = 0 To band.Columns.Count - 1
Dim column As UltraGridColumn = band.Columns(i)
If (column.Key = columnName) Then
column.Hidden = False
column.Width = this.Width
Else
column.Hidden = True
End If
Next
Next
End Sub