Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Urgent help on declaring a variable
#1
Solved: 11 Years, 3 Months, 1 Week ago
Hi All,

Here is my code on a simple calculator application.
I am using QTP 9.2.

Option Explicit
Code:
SystemUtil.Run "calc.exe"
Dim click1,click2, click3, click4,result
click1= inputbox("Enter 1st number")
click2= inputbox("Enter 2nd number")
click3= inputbox("Enter 3rd number")
click4= inputbox("Enter 4 th number")
Window("Calculator Plus").WinButton(Cstr(click1)).Click

Quen: cant I pass the variable click1 directly to the statement with out giving Cstr? Window("Calculator Plus").WinButton(click1).Click

But the problem is even I give Cstr, QTP shows an error at this statemnt- object "4" is not found ....

Could any body help me ASAP please

Thanks
Swetha
Reply
#2
Solved: 11 Years, 3 Months, 1 Week ago
Hi swetha,

It looks a bit strange to me !!

I am using 9.5 V , Its working fine for me without "CSTR".
Hope you have added Calculator appl. Objects in Obj. Repo.

Code:
Option Explicit
SystemUtil.Run "calc.exe"
Dim click1,click2, click3, click4,result
click1= inputbox("Enter 1st number")
click2= inputbox("Enter 2nd number")
click3= inputbox("Enter 3rd number")
click4= inputbox("Enter 4 th number")
Window("Calculator").WinButton(click1).Click
Reply
#3
Solved: 11 Years, 3 Months, 1 Week ago
[quote='sreekanth chilam' pid='9329' dateline='1260189945']
Hi swetha,
I am using QTP 9.2, I did not find any issues while executing and not seen ur issue.
Please check it once again.

Regards,
Venkat.Batchu
Reply
#4
Solved: 11 Years, 3 Months, 1 Week ago
Hi sreekanth and Venkat,

Thank you for your responses. Yes it did work in 9.2 too. Sorry I put my application open for every run , in that way there were many calculators on the taskbar. This could have caused the problem.

Thanks again

swetha
Reply
#5
Solved: 11 Years, 3 Months, 1 Week ago
Hi Swetha,

Its good that you identified where it went wrong on your own.Smile

Sometimes you could find the Answer in your Questions itself.

@All: Hence request you to spend few mins for understanding the problem/issue before you post.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation URGENT: ActiveX component can't create object citibank_ani 3 15,516 09-09-2014, 01:02 PM
Last Post: VarunKaushik
  Issue related to dropdown selection(Please help urgent) excellentpawan123 2 4,229 05-31-2014, 12:00 PM
Last Post: excellentpawan123
  Urgent plz:Dropdown value is not dynamically loadng the subsequent fields accordingly Shwethareddy 0 1,955 12-04-2012, 03:30 PM
Last Post: Shwethareddy
  Urgent-QTP compatibilty with Eclipse sshukla12 0 2,443 09-16-2011, 11:52 AM
Last Post: sshukla12
Shy array or variable need help urgent raydgeek 1 2,293 03-23-2011, 05:59 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)