Forum Discussion
AlexeyKolosov
Staff
15 years agoHi Lars,
It looks as if the target control is owner-drawn. When testing owner-drawn combo boxes, you need to specify combo-box items using their indexes. However, you should be able to retrieve the combo-box items via the native Items collection:
I hope this helps.
It looks as if the target control is owner-drawn. When testing owner-drawn combo boxes, you need to specify combo-box items using their indexes. However, you should be able to retrieve the combo-box items via the native Items collection:
Function SelectOwnerDrawnItem(ComboBox, Text)
For i = 0 to ComboBox.Items.Count-1
Set Item = ComboBox.Items.Item(i)
If Item.OleValue = Text Then
ComboBox.ClickItem(i)
SelectOwnerDrawnItem = True
Exit For
Else SelectOwnerDrawnItem = False
End If
Next
'...
'Usage:
'...
Set combo = ... 'Specify the target combo box's object reference
Text = "MyItemText"
res = SelectOwnerDrawnItem(combo, Text)
If not res Then
Log.Message("The "+Text+" item was not found")
End If
'...
I hope this helps.