Ahmed
  • Ahmed
  • Newbie Topic Starter
2019-11-08T12:22:58Z
Just wondering how the key of a Combo item can be returned. For instance:

    With Me.iGrid1

                .Combos.Add("MyKey")
                .AddItem "Item1"
                .AddItem "Item2"
    End With

I intend to add Combo "MyKey" to iGrid1, if it doesn't exist.
Igor/10Tec
2019-11-08T17:06:01Z
Issue 'On Error Resume Next' and try to retrieve the Combo object using the iGrid.Combos("...") call. If it doesn't exist, an error occurs.

Here is a handy function implementing this idea:

Private Function ComboExists(ByVal psComboKey As String) As Boolean
   Dim oCombo As ComboObject
   On Error Resume Next
   Set oCombo = iGrid1.Combos(psComboKey)
   ComboExists = (Err.Number = 0)
End Function
Ahmed
  • Ahmed
  • Newbie Topic Starter
2019-11-11T11:30:49Z