what is option explicit? what is the use of it?
Answer Posted / kaps
In VB script it’s not necessary to declare a variable explicitly and we can assign a variable at any step we want. This can cause a problem if the project code is huge (while debugging for any bug in script), as the result may be different than expected.
E.g. we declare a string variable as 'strLogin' to save the login detail but later while assigning by mistake we write 'strLogi' then that Login detail will be saved to 'strLogi' instead of 'strLogin'. This will be a bug in script if we use 'strLogin' afterwards for some other inputs. To prevent such scenario VB script provides 'Option Explicit', which forces user to explicitly declare the variable before using it, otherwise script will throw an error at run time.
Option Explicit
Dim strLogin
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Explain actions in qtp ?
How do you delete unwanted results in qtp?
Explain the concept of object repository and how quicktest professional (qtp) recognises objects?
Which advantages helping QTP to hold the position of "Market Leader" for such a long period?
Explain about the quicktest professional (qtp) automation object model?
Our company is having a windows client server application developed in vb.net. so there is a treeview and i am not in a position to record the click events in QTP. so kindly help. Vivek
Is QTP Supports SWT applications? If yes, can you write a sample script for opening a new package in eclipse.
How do we handle run-time errors?
what is the difference between built-i function and In-built function?
Where should i find checkpoint and virtual objects's Object properties and values in the QTP 9.2 Means where checkpoints or virtual objects related data will store If i want to get the runtime object properties how can i use Getroproperties on Checkpoints
what is error and fault in terms of software quality?
Explain runtime dynamic settings?
What is a quick test professional?
What are the data types in qtp?
I have many listboxes in my application. I have to check whether the contents inside the listboxes are in sorted order or not..can anyone please send the code as early as possible