|
-
May 5th, 2010, 02:08 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] By default is option strict on or off
if i don't specify the state of the "Strict" then is it in the On state or Off state, Or it depends upon the value we specify in the VB Options(Tools Menu).
Actually i am exporting some data to excel using late binding. I just copied the code specified in FAQ.
I didnt specify Option strict on or off. And in the VB Options it is set Off.
I am getting an error as "option strict on disallows late binding".
If i specify Option Strict Off in the code,then everything is clear.
-
May 5th, 2010, 02:30 AM
#2
Re: By default is option strict on or off
by default "option strict" should be set to off but you might have option strict set to on in your project properties
go to the toolbar > compile and check it there.
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
May 5th, 2010, 02:48 AM
#3
Re: By default is option strict on or off
There are three places you can set the value of Option Strict: the IDE options, the project properties and the top of a code file. When you first install VS, Option Strict is set to Off in the IDE options. The value set in the IDE options controls the default value in the project properties. When you create a new project, the value for Option Strict will be whatever it is in the IDE options. You can set the value of Option Strict at the top of a code file to affect only that code file, overriding the value in the project properties if it's different. If you don't set it explicitly in a code file then that code file behaves according to the project properties.
This is what you should do:
1. Install VS.
2. Open the IDE options and set Option Strict On, then never change it again.
3. When you create a new project it will have Option Strict set On, and you should never change it.
4. On the rare occasions that you need to use late-binding, e.g. Office Automation, set Option Strict Off in only those code files that require it. You should also break your code up such the the absolute minimum of code is in those files, using partial classes if necessary.
Basically, Option Strict should be On at all times unless you specifically need it Off.
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
|