Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain actions in qtp ?

961


How do you delete unwanted results in qtp?

1112


Explain the concept of object repository and how quicktest professional (qtp) recognises objects?

1051


Which advantages helping QTP to hold the position of "Market Leader" for such a long period?

1828


Explain about the quicktest professional (qtp) automation object model?

971


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

2047


Is QTP Supports SWT applications? If yes, can you write a sample script for opening a new package in eclipse.

3497


How do we handle run-time errors?

1025


what is the difference between built-i function and In-built function?

2153


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

1849


what is error and fault in terms of software quality?

1960


Explain runtime dynamic settings?

2429


What is a quick test professional?

1159


What are the data types in qtp?

1099


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

1879