Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get Item Property
#1
Solved: 11 Years, 4 Months ago
Hi

Value displayed in combobox is LAB & RAD, but 0 and 1 is getting displayed in msgbox i

Code:
ICount  =  SwfWindow(" ").SwfComboBox("SwfComboBox").GetItemsCount
msgbox ICount (Output is 2)

For i  = 0 to ICount - 1
    SwfWindow(" ").SwfComboBox("SwfComboBox").GetItem (i)
    msgbox i (First Iternation 0 and Second Iternation 1)
Next


Attached Files
.doc   Doc1.doc (Size: 131.5 KB / Downloads: 106)
Reply
#2
Solved: 11 Years, 4 Months ago
it is obvious. see, in your code you statement 'msgbox i' clearly says to get an output for values of your variable 'i'
and in the for loop i varies from 0 to 1.
so you are getting the values as 0 and 1.
I guess you are trying to get the selected item.
if yes then use GetSelection method.
e.g.
Code:
msgbox SwfWindow(" ").SwfComboBox("SwfComboBox").GetSelection

Reply
#3
Solved: 11 Years, 4 Months ago
Use this piece of code,

Code:
ICount  =  SwfWindow(" ").SwfComboBox("SwfComboBox").GetItemsCount
msgbox ICount (Output is 2)

For i  = 0 to ICount - 1
itemname =swfWindow(" ").SwfComboBox"SwfComboBox").GetItem (i)
    msgbox itemname
Next

As saket pointed out you are only msgboxing i value then the retireved item value. You have to store it in a variable and then read from it.
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.
Reply
#4
Solved: 11 Years, 4 Months ago
Thanks Saket
I need only the values(LAB & RAD)in the combo box without selecting.
I am using getitem will retrun by index, so first time Lab and second time Rad.
Is my understanding right?
Reply
#5
Solved: 11 Years, 4 Months ago
@Saket - GetSelection will retrieve the item which is selected ( I suspect if there is a getselection for a swfcombobox..not sure yet.). Getitem will retrieve each item available in the collection.
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.
Reply
#6
Solved: 11 Years, 4 Months ago
Yes,, you are right.
if you dont want to select the item then use a variable to get the value and output that variable, as suggested by Basanth.

Reply
#7
Solved: 11 Years, 4 Months ago
Thanks Basanth & Saket
It works.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot identify the specified item Beginner 0 2,482 06-22-2017, 04:55 PM
Last Post: Beginner
  WinListView set item command Shahino007 0 2,645 10-06-2015, 03:57 PM
Last Post: Shahino007
  Get value of a List view item qtpbegin 4 14,198 08-08-2012, 04:58 PM
Last Post: Deepak_QTP
  Creating ObjectRepository item through VBScript LogicaLInsanity 0 2,457 01-24-2012, 03:08 AM
Last Post: LogicaLInsanity
  Err: Cannot identify the specified item of the object. nikku 2 9,808 08-28-2011, 01:40 AM
Last Post: nikku

Forum Jump:


Users browsing this thread: 1 Guest(s)