You could call Remove or RemoveAt to remove the item from the list then call Insert to add it back at the desired index position.
Use this interface to define a custom combo box.
Public Class Combo1 Inherits ESRI.ArcGIS.Desktop.AddIns.ComboBox Public Sub New() 'Add two items to the combo box. Dim o1 As New Point() o1.PutCoords(0, 0) Dim c1 As Integer = Me.Add("Item1", o1) Dim o2 As New Point() o2.PutCoords(1, 1) Dim c2 As Integer = Me.Add("Item2", o2) 'Add the application's caption. Dim app As ESRI.ArcGIS.Framework.IApplication = TryCast(Me.Hook, ESRI.ArcGIS.Framework.IApplication) Me.Add(app.Caption) 'Add one item then remove Dim c3 AsInteger = Me.Add("Item3") Me.Remove(c3) 'Select the second item. Me.[Select](c2) End Sub Protected Overloads Overrides Sub OnSelChange(ByVal cookie AsInteger) If cookie = -1 Then Exit Sub End If 'Get the associated object. Dim tag As Point = TryCast(Me.GetItem(cookie).Tag, Point) If tag IsNot Nothing Then System.Windows.Forms.MessageBox.Show((tag.X & ", ") + tag.Y) End If End Sub Protected Overloads Overrides Sub OnEnter() 'Loop through the item collection. Fo rEach item As ESRI.ArcGIS.Desktop.AddIns.ComboBox.Item In Me.items If Me.Value = item.Caption Then Exit Sub End If Next Me.Add(Me.Value) End Sub Protected Overloads Overrides Sub OnEditChange(ByVal editString AsString) If String.Compare(editString, "ABC", True) = 0 Then System.Windows.Forms.MessageBox.Show("editString is " & Me.Value) End If End Sub Protected Overloads Overrides Sub OnFocus(ByVal [set] AsBoolean) If [set] Then System.Diagnostics.Debug.WriteLine("Get focus.") End If If Not [set] Then System.Diagnostics.Debug.WriteLine("Lose focus.") End If End Sub Protected Overloads Overrides Sub OnUpdate() Me.Enabled = ArcMap.Application Is Not Nothing End Sub End Class
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.