Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to validate combobox values with testdata values
#1
Solved: 11 Years, 4 Months, 4 Weeks ago
I have one combobox ,having values like value1,value2...this is displaying at UI,i want to validate this values with my Expected values(Testdata).My code is like

Code:
val=window("").wincombobox("").getitemscount

for i=0 to val-1

d=window("").wincombobox("").getitem(i)

s=s+d+vbnewline
print s

watever values in the combobox all values dispaly in the window.
Now i want to compare these values with my testdata values.These test data values in the textfile like val1,val2 ,val3 like
How can i compare and report my results.Pls give me the code
Reply
#2
Solved: 11 Years, 4 Months, 4 Weeks ago
You can try this
Code:
Set fso=createObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(YourFilePath, 1)
Dim strLine, arrLine, bMatch
if f.AtEndOfStream <> True
            strLine = f.ReadLine
            arrLine = split(strLine,",")
end if

val=window("").wincombobox("").getitemscount

bMatch = 0
for i= 0 to val-1
    d=window("").wincombobox("").getitem(i)
    if d = arrLine(i) Then bMatch = 1
Next

If bMatch = 1 then
    Msgbox "Compare - Failed"
Else
    Msgbox "Compare - Passed"
End if

I am assuming you have values in the text file in the form "Val1,Val2,.."
let me know if it works..

Reply
#3
Solved: 11 Years, 4 Months, 4 Weeks ago
In combobox i have values -India
USA
London
Japan
In my textfile having--India1,USA1,London,Japan
After Executing above code (urs).iam getting msg Has "Compare pass",but i given the wrong values in the textfile,y its like ..if i give right values ,then also its giving same .
Reply
#4
Solved: 11 Years, 4 Months, 4 Weeks ago
Sorry my mistake, Can you please correct this statement in the above code and try again
Code:
if d <> arrLine(i) Then bMatch = 1

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Not able to get the list of items in Delphi Combobox Environment Object Raj Aryan Singh 3 2,345 02-04-2020, 12:32 AM
Last Post: Raj Aryan Singh
  Dynamic Values Identification PreethiJoshi 1 1,212 04-26-2018, 10:50 AM
Last Post: Ankur
  Need help for copying values from one excel to another excel vinodhiniqa 0 1,378 07-06-2017, 05:33 PM
Last Post: vinodhiniqa
  How import final calculated values by cell formula from Excel not the formula itself. qtped 1 4,896 01-17-2017, 04:05 PM
Last Post: sagar.raythatha
  Need to verify the drop down values based on condition santhoshmscsoftware 1 2,969 05-04-2016, 11:28 PM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 1 Guest(s)