Issue with Variable scope - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Issue with Variable scope (/Thread-Issue-with-Variable-scope) |
Issue with Variable scope - rk_11 - 03-12-2010 Hi Friends, In my code I've a variable decalred "Dim notLaunched" before a Select statement and later with in the select statement its used to define to zero and later modified in an If loop to "1". but one its out of if loop the value of variable is coming back to "0". I couldn't understand why is it like that. I changed the code to "Static notLaunched" there is an syntax error. I put it as public same issue. Please help me ... Here is my code .. Code: Dim notLaunched RE: Issue with Variable scope - Saket - 03-12-2010 is this a certification query? request you to please put your queries in appropriate forum category. thread moved where actually you are trying to get the value of the variable - notLaunched? I tried executing your code, and its working perfectly. I dont see any issue with that. One which I noticed is - you will never get the value of notLaunched as 1 in the same action further. because at the place where your assigning it to 1 after this you are exiting from the action. you will always get the value 0 in the action which is set in the else part. |