DotNetFactory form using .NET ListBox objects
After doing multiple Google searches and looking here via search I've decided to post this question and see if anyone else has a good idea/solution.
In QTP 9.5 I've used the DotNetFactory to build a form and put a .NET ListBox control on it for users to select the items to test in an application. I prepopulate the Listbox with the items, and get it on the form. It is setup as a MultiSelect control. All that works well.
My issue is getting the information back from the ListBox object for what was selected by the user. I'm looking at the object definition and property/methods in VS2008 VB.Net to model what I need. There are a couple of methods (GetSelected, GetItemText) I'm trying to use and keep getting 'Exception Thrown' errors.
I'm not sure what I'm doing wrong. Any ideas and/or help is appreciated. Thanks.
Re: DotNetFactory form using .NET ListBox objects
GetSelected, GetItemText are not the right methods or properties to get the selected items in the list
Ways to get selected items from list
1) If your list box is not multi selected, it is very simple
just use .Text property
2) If you need to get multiple selected items from a list box then , you have use the SelectedItems collection object and then retrive the values from the collection
use the following code
For i=0 to objList.SelectedItems.Count-1
msgbox "The Item you have selected Is: "& objList.SelectedItems.Item(Cint(i))
please let me know weather it is working for you or not