Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Private Sub Button9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button9.Click
' If the value list has already been created, then return since we
' don't want to recreate it again.
If Me.ultraGrid1.DisplayLayout.ValueLists.Exists("VL1") Then Return
' Create a value list with the key of VL1.
Dim valueList As valueList = Me.ultraGrid1.DisplayLayout.ValueLists.Add("VL1")
' Add some items to it. Here the items added have numeric data values and
' associated display texts. What the user sees in the cells is the display
' text for these underlying numeric data value. Also when the user modifies
' a cell and selects one of the item, what goes in the data source is the
' associated numeric value.
valueList.ValueListItems.Add(1, "One")
valueList.ValueListItems.Add(2, "Two")
valueList.ValueListItems.Add(3, "Three")
valueList.ValueListItems.Add(4, "Four")
valueList.ValueListItems.Add(5, "Five")
' Get the column you want to use the value list in.
Dim column As UltraGridColumn = Me.ultraGrid1.DisplayLayout.Bands(0).Columns(0)
' Now assign the value list to that column.
column.ValueList = valueList
' Optionally set the style of that column to an appropriate drop down style.
' DropDownValidate style ensures that the user enters only the values found
' in the value list.
column.Style = ColumnStyle.DropDownValidate
' When AutoEdit is turned on on a column with value list assigned to it, the
' UltraGrid auto-completes the text in the cell as the user types to a matching
' item in the value list. This is enabled by default, however you can turn it
' off by setting AutoEdit to false.
column.AutoEdit = False
End Sub