Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wincombobox issue
#1
Not Solved
Hi,
Code:
Set a=CreateObject("scripting.filesystemobject")

Set b=a.opentextfile("C:\Documents and Settings\madhu\Desktop\te.txt",1)

  If  b.atendofstream <>  true Then
   c=b.readline
  

  
End If
  


d=Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
temp=0

For i=0 to d-1

     g=Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)

   h=h+g+";"

  

Next
MsgBox h
If h = c  then  temp=1
    If temp=1 Then

        MsgBox "pass"

        else

        MsgBox  "Fail"
    End If
Window("Flight Reservation").Close

*** Above code is working fine when having the text file with values like this formatBig Grinenver;Frankfurt;London;Los Angeles;Paris;Portland;San Francisco;Seattle;Sydney;Zurich;

But same textfile format values like,its not working .pls suggest me .

Denver
Frankfurt
London
Los Angeles
Paris
Portland
Francisco
Seattle
Sydney
Zurich
Reply
#2
Not Solved
You just need to investigate why the code is working for your first case?
In in the required format itself, for the first case All the items are listed with a semicolon and in second its with a return character.
use vbcrlf instead of ';' in your code.

Reply
#3
Not Solved
In my 1st case i hav text file values like :Va1;val2;and so on and retrived combobox values changed as c=c+g+";".so its working

But now text file values as

val1
val2

--

-- so on

i changed the retrieved combobox values as c=c+g+vbcrlf

But my code is not working,pls suggest
Reply
#4
Not Solved
Try with c=c+g+VBLF
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
#5
Not Solved
Hi Madhu,

If the data in your text is seperated by return character, that means all the data val1,Val2 ... are in different lines. so if you will use ReadLine while retriving values from your text file it will always return the first value ie Val1 (with above statements in your code) and so the comarison will be fail. Use ReadAll to retreive all the text in your file and thenn compare, It should work.

Reply
#6
Not Solved
Saket ,yes i did b=a.readdall

then i compared .Its not at all working .
Changed the code as per saket AND Basanth ..still not working .Below one is my changed code as per saket

Code:
Set a=CreateObject("scripting.filesystemobject")

Set b=a.opentextfile("C:\Documents and Settings\madhu\Desktop\te.txt",1)


c=b.readall



End If



d=Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
temp=0

For i=0 to d-1

g=Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)

h=h+g+vbcrlf



Next
MsgBox h
If h = c then temp=1
If temp=1 Then

MsgBox "pass"

else

MsgBox "Fail"
End If
Window("Flight Reservation").Close
Reply
#7
Not Solved
"b = a.readdall"??
as per your code in the first post of this thread, you should use
c=b.readall

can you paste your complete code , may be that can help us to identify the issue.
I tried with your earlier code, it working fine at my side with required modification.
when you say not working at all means -are you getting any error message or your comparison fails? with your modified code you will get the error message "Expected statement", anyway- you can check with the code below
Code:
Set a=CreateObject("scripting.filesystemobject")

Set b=a.opentextfile("C:\Documents and Settings\madhu\Desktop\te.txt",1)

If b.atendofstream <> true Then
c=b.readall
End If



d=Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
temp=0

For i=0 to d-1

g=Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)

h=h+g+vbcrlf



Next
MsgBox h
If h = c then temp=1
If temp=1 Then

MsgBox "pass"

else

MsgBox "Fail"
End If
Window("Flight Reservation").Close
also I found that the data you have mentione in the query and you are using to verify that is not proper. There should be 'San Francisco' instead of 'Francisco'. check this out may be this is the reason your comparison gets fail.

also if you remove IF statement remove the End IF statement as well.

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Has anyone seen wincombobox.select leave the window? RandomGrin 1 2,866 12-23-2014, 01:52 PM
Last Post: neha kandhari

Forum Jump:


Users browsing this thread: 1 Guest(s)