I am evaluating the activeX and cannot find the information on how to set the default index of a combo list.

If i add 10 items to a combo list and for example i want the fifth item to be an initial default shown to the user.

Also how do you set the font and size of items in the list?

many thanks
To specify the default combo list item in a column, use the default column cell. You need to specify the default cell value associated with your default combo list item as iGrid finds the item to display by the cell value.

Below is a code snippet that demonstrates how to create a grid with one combo list column and use the 3rd combo list item as the default item. As you can see, we also change the font of combo list items to Verdana 10pt.

Dim vDefaultCbo1ItemValue As Variant

With iGrid1
   With .Combos.Add("cbo1")
      .AddItem "Item 1"
      .AddItem "Item 2"
      .AddItem "Item 3"
      .AddItem "Item 4"
      vDefaultCbo1ItemValue = .ItemValue(2)
      Set .Font = New StdFont
      .Font.Name = "Verdana"
      .Font.Size = 10
   End With
   With .ColDefaultCell(1)
      .eType = igCellCombo
      .sCtrlKey = "cbo1"
      .vValue = vDefaultCbo1ItemValue
   End With
   .ShowControlsInAllCells = True
   .RowCount = 10
End With

thank you for the reply.

Do you know how to have a combo box on the first row only and to default that one when loading.

Your code puts a combo box on every row and i cannot seem to change that.

thank you
ALso how do you find out the item value of the selected combo option?

.AddItem sItemText:=CStr(Desc), vItemValue:=CStr(ID)

what to return the item Value of whatever option is selected.

thank you
Do you want to know the item value selected in a cell? It's the cell's value returned by the CellValue property (when the user selects a combo list item, the corresponding value is stored as the cell's value).

I am not looking for the text selected in the combo but the ID value of the selected item.


If i add a combo list item of "item 1.1" with an ID value of 50 i am looking for 50 to be returned.

Yes, I meant exactly that in my answer. What you see on the screen is returned by the CellText property, whereas the CellValue property stores the "invisible" item value (what you defined with vItemValue in the ComboObject.AddItem call).