Imports Infragistics.Win Imports Infragistics.Win.UltraWinEditors Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Set focus to the UltraComboEditor Me.UltraComboEditor1.Focus() ' Clear the existing list Me.UltraComboEditor1.Items.Clear() ' Add 5 items to the list 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") ' Show the list portion Me.UltraComboEditor1.DropDown() ' Use the FindString method to determine the index of the ' item whose text is "Four" Dim index As Integer = Me.UltraComboEditor1.FindStringExact("Four", 0) ' Set the SelectedIndex property to the item we found ' via the call to the FindString method Me.UltraComboEditor1.SelectedIndex = index End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinEditors; private void button1_Click(object sender, System.EventArgs e) { // Set focus to the UltraComboEditor this.ultraComboEditor1.Focus(); // Clear the existing list this.ultraComboEditor1.Items.Clear(); // Add 5 items to the list this.ultraComboEditor1.Items.Add( 1, "One" ); this.ultraComboEditor1.Items.Add( 2, "Two" ); this.ultraComboEditor1.Items.Add( 3, "Three" ); this.ultraComboEditor1.Items.Add( 4, "Four" ); this.ultraComboEditor1.Items.Add( 5, "Five" ); // Show the list portion this.ultraComboEditor1.DropDown(); // Use the FindString method to determine the index of the // item whose text is "Four" int index = this.ultraComboEditor1.FindStringExact( "Four", 0 ); // Set the SelectedIndex property to the item we found // via the call to the FindString method this.ultraComboEditor1.SelectedIndex = index; }