how do you make the variable declaration mandatory?what is the use of "option explicit"?
Answers were Sorted based on User's Feedback
Option Explicit
Dim strValue, strValue
strValue = 20
'Expected Error: Name(Variable) is redefined
Dim intA, intB
intC= intA+intB
'Expected Error: Name(Variable is undefined)
Note: If we can use Option Explicit we have To pass the all the variables And it Is indentify undefined And redefined
variables
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sonali
Option explicit will make compulsory to define each variable in the script .
if at the top of the script we have written "Option Explicit" and in Dim only two variables assigned but in script somewhere used 3rd and 4th variable also .
then it will display an error message stating that "Variable is Undefined " .
It will be very very usefull in lenghy scripts where we will use different Functions and then call functions .
| Is This Answer Correct ? | 0 Yes | 0 No |
How will you convert a string to upper case string using vbscript?
Hello All, In QTP 9.2 for Mozilla Firefox, there is webelement in my application, I tried to click on that using decsriptive programming, but it does not work. and for this i tried this code too: Set obj = CreateObject ("Mercury.DeviceReplay") absx = Browser("").Page("").WebElement(".").GetROProperty ("abs_x") absy = Browser("").Page("").WebElement(".").GetROProperty ("abs_y") obj.MouseMove absx, absy obj.MouseClick absx, absy, 0 But it is not clicked. Can anyone help me out for this problem. Thnx in Advance
PLz send me the VB scripts which is having more examples my email id : hareen_11@yahoo.com
Please let me Know regarding any material regarding VB Scripting which should be easily understandable for Beginners.
How can you destroy an object in vbscript?
What are the differences between sub procedures and function procedures?
How to create a function in vbscript?
Explain vbscript in detail?
How will you get the exponent of the given number in vbscript?
How to pass argument by reference to a function in vbscript?
Which respective symbols are used to separate a line and to break the lengthy statement into multiple statements in the vbscript language?
. Program for sorting of numbers in vb script?