Imports Infragistics.Win
Imports Infragistics.Win.UltraWinEditors
Private Sub SetupMRUList()
' Remove the existing items from the control's Items collection
Me.UltraComboEditor1.Items.Clear()
' Add items to the control's Items collection, using the overload
' that allows us to specify a data value and display text
Me.UltraComboEditor1.Items.Add(1, "One")
Me.UltraComboEditor1.Items.Add(2, "Two")
Me.UltraComboEditor1.Items.Add(3, "Three")
Me.UltraComboEditor1.Items.Add(4, "Four")
Me.UltraComboEditor1.Items.Add(5, "Five")
' Set the HasMRUList property to true, so the MRUList will be displayed
Me.UltraComboEditor1.HasMRUList = True
' The MRUList will be initially empty, but we can pre-populate
' it by setting the MRUList property. Create and object array
' with 3 elements, and add the data values of the odd-numbered
' items to the array. This will cause them to appear in the MRUList
' the first time the list portion appears.
'
' Create an object array
Dim mruItems(Me.UltraComboEditor1.Items.Count) As Object
' Iterate the items in the control's Items collection; for each item
' whose data value is an odd number, add an element to the array.
Dim i As Integer
For i = 0 To Me.UltraComboEditor1.Items.Count
Dim valueListItem As ValueListItem = Me.UltraComboEditor1.Items(i)
Dim dataVal As Integer = valueListItem.DataValue
If ((dataVal Mod 2) <> 0) Then
mruItems(i) = dataVal
End If
Next
' Set the control's MRUList property to the object array
' Note that the MRU items that do not match an item in
' the control's Items collection will be removed , since MRU
' items only have relevance when they match an item.
Me.UltraComboEditor1.MRUList = mruItems
' Set the MaxMRUItems property to 3 so that no more than
' 3 items appear in the MRUList.
Me.UltraComboEditor1.MaxMRUItems = 3
' Select the first item in the Items collection
Me.UltraComboEditor1.SelectedIndex = 0
End Sub