hawkeye
2016-07-12T07:10:40Z
Hello

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
Igor/10Tec
2016-07-13T11:25:01Z
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
   .BeginUpdate
   
   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
   
   .AddCol
   With .ColDefaultCell(1)
      .eType = igCellCombo
      .sCtrlKey = "cbo1"
      .vValue = vDefaultCbo1ItemValue
   End With
   
   .ShowControlsInAllCells = True
   .RowCount = 10
      
   .EndUpdate
End With
hawkeye
2016-07-14T10:44:43Z

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
hawkeye
2016-07-14T11:13:37Z
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
Igor/10Tec
2016-07-15T07:34:54Z
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).
hawkeye
2016-07-15T08:25:00Z

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

vItemValue

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.

Igor/10Tec
2016-07-15T09:05:58Z
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).