Forum Discussion
AlexeyKolosov
Staff
15 years agoHi Lars,
You can use the wItemList property to obtain combo-box items. The following script demonstrates this approach:
I recommend that you refer to "Working With Combo Box Controls" and related help topics for more information.
You can use the wItemList property to obtain combo-box items. The following script demonstrates this approach:
Function SelectItemByText(ComboBox, Text)
Dim p, w, i, ItemString, Del, Item
ItemString = ComboBox.wItemList
Del = ComboBox.wListSeparator
aqString.ListSeparator = Del
for i = 0 to ComboBox.wItemCount-1
Item = aqString.GetListItem(ItemString, i)
If Item = Text Then
ComboBox.ClickItem(Item)
SelectItemByText = True
Exit For
Else SelectItemByText = False
End If
next
End Function
'...
Usage:
'...
Set combo = ... 'Specify the target combo box's object reference
Text = "MyItemText"
res = SelectItemByText(combo, Text)
If not res Then
Log.Message("The "+Text+" item was not found")
End If
'...
I recommend that you refer to "Working With Combo Box Controls" and related help topics for more information.