469,613 Members | 1,772 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

What does this do?Option Explicit?

ken
hi All

What does this command dot

Option Explicit
Nov 20 '05 #1
5 1904

"ken" <an*******@discussions.microsoft.com> a écrit dans le message de
news:CC**********************************@microsof t.com...
hi All.

What does this command dot?

Option Explicit


When you specify Option Explicit on, you are obliged to declare all your
variables before using them.
Nov 20 '05 #2
>Option Explicit

It ensures all variables are declared before you can use them.

http://msdn.microsoft.com/library/de...onExplicit.asp

Cheers

Blu
Nov 20 '05 #3
ken wrote:
What does this command dot?

Option Explicit


Hi ken,

Option Explicit means that you have to declare your variables before you
can use them.

Option Explicit On

Private Sub Button1_Click(...) Handles Button1.Click
i = 1
End Sub

--> Compiler Error. You have to declare i first: Dim i as Integer
Option Explicit Off

Private Sub Button1_Click(...) Handles Button1.Click
i = 1
End Sub

--> no compiler error.

There is only one thing to say about Option Explicit Off: do not use it.

It makes your code less safe and errors will be hard to detect.

Cheers

Arne Janning
Nov 20 '05 #4
"ken" <an*******@discussions.microsoft.com> schrieb
hi All.

What does this command dot?

Option Explicit


http://msdn.microsoft.com/library/en...onExplicit.asp
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
* =?Utf-8?B?a2Vu?= <an*******@discussions.microsoft.com> scripsit:
What does this command dot?

Option Explicit


Place the caret on 'Option Explicit' and press the F1 key.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

23 posts views Thread by darwinist | last post: by
54 posts views Thread by Brandon J. Van Every | last post: by
11 posts views Thread by Troll | last post: by
8 posts views Thread by biro man | last post: by
1 post views Thread by Robert Mark Bram | last post: by
12 posts views Thread by Doug Hill | last post: by
1 post views Thread by ARC | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.