Micro Focus QTP (UFT) Forums
Combobox list to datatable - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Combobox list to datatable (/Thread-Combobox-list-to-datatable)



Combobox list to datatable - sarahb - 03-17-2011

I want to write a script for getting the combobox list items into datatable. I have succeeded so far, can get data but all the list is coming in one cell, i want them to append the list in different cell, one after the other.
I did tried to change the script but this time its displaying only one item of combobox.
If anyone can help, pl do so

many thanx


RE: Combobox list to datatable - basanth27 - 03-17-2011

Are you using a loop? If yes, would you please paste it so that i can modify it ?


RE: Combobox list to datatable - berula - 03-17-2011

use

Code:
my_Array=Split(SwfComboBox("xxxxxx").GetContent,chr(10))

to get an array with the entries from the combobox


RE: Combobox list to datatable - basanth27 - 03-17-2011

Berula -
How do you know it is a swfcombobox? it could be a weblist as well, in which case the method would be different. You may have to wait until the questioner posts more details which will help everyone to stay not confused.


RE: Combobox list to datatable - berula - 03-17-2011

It also works on a weblist. The important point ist to split with chr(10).


RE: Combobox list to datatable - basanth27 - 03-17-2011

You wouldnt wait..would you Smile. Well the objective of me asking you to wait was to let you know that, from the question, logically the questioner has been able to get the items but is not able to write it correctly on to the cell of the datatable. So, a wild guess, in this case, would be that, the loop is writing to the same cell and is not being iterated.
I have been able to plough this far and i would bet on it. However, we need to rein on our instinct and wait for the questioner to post briefly which will help one and all.