Forum Discussion
sbkeenan
12 years agoFrequent Contributor
Hi
I've been doing some testing on an application that uses the DevXpress LookUpEdit control (v10.2.5.0) and wanted to create a function that would allow me to select an item in the dropdown either by its text value or by its index. The function will return a 'True' if the specified item is found (it also selects that item) or a 'False' if it isn't found in the dropdown. If selecting an item by its index, the function will return an array, containing either 'True' and the selected index's text, or a 'False' togeher with an empty string. The idea here is that I simply wanted to be able to specify specifically what was selected in the log file. The function (in VBScript), looks like this:
I've been doing some testing on an application that uses the DevXpress LookUpEdit control (v10.2.5.0) and wanted to create a function that would allow me to select an item in the dropdown either by its text value or by its index. The function will return a 'True' if the specified item is found (it also selects that item) or a 'False' if it isn't found in the dropdown. If selecting an item by its index, the function will return an array, containing either 'True' and the selected index's text, or a 'False' togeher with an empty string. The idea here is that I simply wanted to be able to specify specifically what was selected in the log file. The function (in VBScript), looks like this:
public function setLookupEdit(lookUpEditCtrl, item)
dim i ' Index counter
if CStr(item) = item then ' item is a text value
i = lookUpEditCtrl.FindItem_2(item, False, 0)
if i >= 0 then 'item found
call lookUpeditCtrl.set_ItemIndex(i)
setLookUpEdit = True
else
setLookupEdit = False
end if
else 'item is a numeric value
dim result(1)
if item > 0 then
if item < lookUpEditCtrl.Properties_2.DataSource.Count then
call lookUpEditCtrl.set_ItemIndex(item)
result(0) = True
result(1) = lookUpEditCtrl.Text
setLookupEdit = result
else
result(0) = False
result(1) = ""
setLookupEdit = result
end if
end if
end if
end function
Related Content
- 9 years ago
Recent Discussions
- 2 days ago
- 2 days ago
- 5 days ago