|
-
May 14th, 2006, 05:34 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] What is option explicit
What is option explicit? Why it is applied?
Dont rely only on your luck. Work hard until You get success.
vb Code:
Private sub Time_ispassing
While Me.Notgetsuccess
trygain=tryagain+1
Me.workhard
wend
end sub
-
May 14th, 2006, 05:37 AM
#2
Re: What is option explicit
It forces you to predeclare your variables before using them.
-
May 14th, 2006, 05:50 AM
#3
PowerPoster
Re: What is option explicit
Use Option Explicit tol avoid using variables which are not needed or used in the program. Useless variables eat up memory.
-
May 14th, 2006, 05:53 AM
#4
Re: What is option explicit
Basically you use it to catch any spelling mistakes. Mispelled variables will be declared as variants when they come into scope which, as well as taking up memory, will cause your code to go screwy and make it v. hard to debug. Always use it!
-
May 14th, 2006, 06:08 AM
#5
Re: What is option explicit
You should add an Option Explicit statement at the very beginning of the code module so that Visual Basic will automatically trap any attempt to use a variable that isn't declared anywhere in the program code. By this single action, you'll avoid a lot of problems later in development phase.
-
May 14th, 2006, 06:11 AM
#6
Re: What is option explicit
If you go Tools -> Options and then check Require Variable Decleration, then it will always be placed at the top of any new form, module, class etc that you create (no need to write it in)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|