How to get a value from a List view.
For me x = SwfWindow("Connected to 157.235.206.175").SwfListView("inventoryList").GetVisibleText is showing the entire value in the listview.
My List view has 10 columns and 5 rows.
I need the value of the third column in second row.
How I can get it.
Please help me.
The Below program might solve your problem
a brief explanation of the below program
1) get total no of columns --------->(ColumnCount)
2) get total no rows in the wilnlist view------->(GetItemsCount)
3) retrieve the desired value from the column------>(GetSubItem(i,C_Name))
Code:
With Dialog("Text:=Windows Task Manager")
.wintab("nativeclass:=SysTabControl32").Select "Processes"
R_Count=.WinListView("nativeclass:=SysListView32").GetItemsCount
'msgbox ("Total no of rows"&R_Count)
C_Count=.WinListView("nativeclass:=SysListView32").ColumnCount
'msgbox ("Total no of columns: "&C_Count)
For i=0 to R_Count-1
For j=0 to C_Count-1
C_Name=.WinListView("nativeclass:=SysListView32").GetColumnHeader(j)
t= .WinListView("nativeclass:=SysListView32").GetSubItem(i,C_Name)
Next
Next
End With
i hope the above program will help you
Thanks sree.....
Everything works for me except two line
1)stView_ChildObjects")=t
2)Endwith
Can I store the values of C_name and t in a two diamensional array in QTP?
the above two lines are not required for u. you can comment those lines...
"C_name" it the name of the coloumn and t is the values in the column like
C_name
--------
aaaa
bbbb
cccc
so you can't take the data into a two dimensional array
but u can load the data into a data table or to an excel sheet
Hi Sree,
Thanks a lot for this post.
Regards,
Deepak