07-02-2009, 06:52 PM
Robocom-
You have the logic. You can easily find the solution too if you made a bit more research.
Whenever you post a question dont forget to give details like,
1. Version of QTP you are using ??
2. Application Interface host technology ?
3. Any third party controls or add-ins etc.
Now assuming it is a listbox let me extend to you a hint,
I hope this helps. You may need to tweak it according to your requirement.
You have the logic. You can easily find the solution too if you made a bit more research.
Whenever you post a question dont forget to give details like,
1. Version of QTP you are using ??
2. Application Interface host technology ?
3. Any third party controls or add-ins etc.
Now assuming it is a listbox let me extend to you a hint,
Code:
Dim oItems(100)
oListItems = obj.weblist("listbox").Getroproperty("all items")
oItems = Split(oListItems, ";")
oListCount = obj.weblist("listbox").Getroproperty("items count")
or
oListCount = Ubound(oItems)
For i = 0 to oListCount - 1 'Expecting values from DB are the same as on the application
If Instr(oItems(i), ItemsfromDB(i)) >0 Then
Reporter.reportevent micpass, "ITem exist", "Item exist"
Else
Reporter.reportevent micfail, "Item Does not Exist", "ITem does not exist"
End if
Next
I hope this helps. You may need to tweak it according to your requirement.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.