473,732 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Option Strict and aspnet 2.0

I fully expected the lack of a way to set Option Strict globally to be fixed
in SP1. I can't seem to figure out if it has been fixed or not. It still
seems we have to add the declaration at the top of each and every single
code module. Am I missing something here?

--
-C. Moya
www.cmoya.com
Jan 18 '07 #1
13 2324
To set Option Strict

1. With your VB Web project open, click "Tools", then "Options".
2. Make sure the "Show all settings" box is selected.
3. Go to "Projects and Solutions", and scroll down to "VB defaults".

You'll see the "Default Project Settings" and the "Option Strict" dropdown,
with "On" and "Off" choices.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"C. Moya" <cm*@nospam.com wrote in message news:eD******** ******@TK2MSFTN GP04.phx.gbl...
>I fully expected the lack of a way to set Option Strict globally to be fixed in SP1. I can't seem
to figure out if it has been fixed or not. It still seems we have to add the declaration at the top
of each and every single code module. Am I missing something here?

--
-C. Moya
www.cmoya.com


Jan 18 '07 #2
Did you try this answer before offering it? My settings are already set to
this. I then created a new class in my web project (thinking it's only
applied to new files added) and was able to add
Dim i As Integer = "some text"
with no problem.

That's bad.

--
-C. Moya
www.cmoya.com
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
To set Option Strict

1. With your VB Web project open, click "Tools", then "Options".
2. Make sure the "Show all settings" box is selected.
3. Go to "Projects and Solutions", and scroll down to "VB defaults".

You'll see the "Default Project Settings" and the "Option Strict"
dropdown,
with "On" and "Off" choices.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"C. Moya" <cm*@nospam.com wrote in message
news:eD******** ******@TK2MSFTN GP04.phx.gbl...
>>I fully expected the lack of a way to set Option Strict globally to be
fixed in SP1. I can't seem
to figure out if it has been fixed or not. It still seems we have to add
the declaration at the top
of each and every single code module. Am I missing something here?

--
-C. Moya
www.cmoya.com



Jan 18 '07 #3
I havent used VB.Net in a while, I only use C# nowadays, but I seem to
remember that if you want to set option strict globally you need to
open visual studio to the start page, with no project loaded and change
the option strict setting then. all new projects from then on will be
option strict by default.

worth a try, but as I said, I haven't used VB for a while

C. Moya wrote:
I fully expected the lack of a way to set Option Strict globally to be fixed
in SP1. I can't seem to figure out if it has been fixed or not. It still
seems we have to add the declaration at the top of each and every single
code module. Am I missing something here?

--
-C. Moya
www.cmoya.com
Jan 18 '07 #4
Not sure as not yet for real under 2.0 but I remember to have seen this is
now in the web.config file i.e. it could be perhaps different dpeending on
weteherr you are prcompiling the site (in whihc case the project level
property could aply) or on the fly (in which case the web.config option
could be used).
"C. Moya" <cm*@nospam.com a écrit dans le message de news:
eD************* *@TK2MSFTNGP04. phx.gbl...
>I fully expected the lack of a way to set Option Strict globally to be
fixed in SP1. I can't seem to figure out if it has been fixed or not. It
still seems we have to add the declaration at the top of each and every
single code module. Am I missing something here?

--
-C. Moya
www.cmoya.com

Jan 18 '07 #5
I have Option Strict On in Tools|Options->VB Defaults.
And also strict="true" in web.config.
It doesn't seem to matter.

It's also not in the list of bug fixes for SP1 (which is a fairly small list
considering the ludicrous amount of time that we've been waiting). But I
find it hard to believe that this hasn't been addressed... I'm hoping I'm
just overlooking something.

--
-C. Moya
www.cmoya.com
"Patrice" <http://www.chez.com/scribe/wrote in message
news:uV******** ******@TK2MSFTN GP03.phx.gbl...
Not sure as not yet for real under 2.0 but I remember to have seen this is
now in the web.config file i.e. it could be perhaps different dpeending on
weteherr you are prcompiling the site (in whihc case the project level
property could aply) or on the fly (in which case the web.config option
could be used).
"C. Moya" <cm*@nospam.com a écrit dans le message de news:
eD************* *@TK2MSFTNGP04. phx.gbl...
>>I fully expected the lack of a way to set Option Strict globally to be
fixed in SP1. I can't seem to figure out if it has been fixed or not. It
still seems we have to add the declaration at the top of each and every
single code module. Am I missing something here?

--
-C. Moya
www.cmoya.com


Jan 18 '07 #6
re:
That's bad.
It would only be bad if you couldn't modify the VS templates.

To change the default value of Option Strict, follow these steps:

Locate WebApplication. vbproj, inside:
drive:\VStudioI nstallDir\Commo n7\IDE\ProjectT emplates\Visual Basic\Web\1033\ WebApplicationP roject.zip

Extract it, modify the Option Strict line so it's On, save the file
and add it back to the zip file, overwriting the original file.

Notice thre's other files in the same zip file where the option must be set, too.

Also, do the same for any file in:
drive:\VStudioI nstallDir\Commo n7\IDE\ProjectT emplates\Visual Basic\Web
which has Option Strict = Off

I agree that the IDE is buggy regarding the setting of this option,
but there's a viable workaround, as detailed in this post.

btw, if you want to change the Option Strict option for other types of projects
( Windows app, Windows Service, etc. ), you'll need to do the same for *their* templates.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"C. Moya" <cm*@nospam.com wrote in message news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Did you try this answer before offering it? My settings are already set to this. I then created a
new class in my web project (thinking it's only applied to new files added) and was able to add
Dim i As Integer = "some text"
with no problem.

That's bad.

--
-C. Moya
www.cmoya.com
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>To set Option Strict

1. With your VB Web project open, click "Tools", then "Options".
2. Make sure the "Show all settings" box is selected.
3. Go to "Projects and Solutions", and scroll down to "VB defaults".

You'll see the "Default Project Settings" and the "Option Strict" dropdown,
with "On" and "Off" choices.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============== =============== ======
"C. Moya" <cm*@nospam.com wrote in message news:eD******** ******@TK2MSFTN GP04.phx.gbl...
>>>I fully expected the lack of a way to set Option Strict globally to be fixed in SP1. I can't seem
to figure out if it has been fixed or not. It still seems we have to add the declaration at the
top
of each and every single code module. Am I missing something here?

--
-C. Moya
www.cmoya.com





Jan 18 '07 #7
I will try this workaround... though it seems kludgy. Regarding other types
of projects: no need... as Windows Forms projects respect the Option Strict
settings you specify. It's only ASP.NET 2.0 projects that brainnumbingly do
not.

Thanks for the tip.

--
-C. Moya
www.cmoya.com
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:uT******** ******@TK2MSFTN GP03.phx.gbl...
re:
>That's bad.

It would only be bad if you couldn't modify the VS templates.

To change the default value of Option Strict, follow these steps:

Locate WebApplication. vbproj, inside:
drive:\VStudioI nstallDir\Commo n7\IDE\ProjectT emplates\Visual Basic\Web\1033\ WebApplicationP roject.zip

Extract it, modify the Option Strict line so it's On, save the file
and add it back to the zip file, overwriting the original file.

Notice thre's other files in the same zip file where the option must be
set, too.

Also, do the same for any file in:
drive:\VStudioI nstallDir\Commo n7\IDE\ProjectT emplates\Visual Basic\Web
which has Option Strict = Off

I agree that the IDE is buggy regarding the setting of this option,
but there's a viable workaround, as detailed in this post.

btw, if you want to change the Option Strict option for other types of
projects
( Windows app, Windows Service, etc. ), you'll need to do the same for
*their* templates.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"C. Moya" <cm*@nospam.com wrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>Did you try this answer before offering it? My settings are already set
to this. I then created a
new class in my web project (thinking it's only applied to new files
added) and was able to add
Dim i As Integer = "some text"
with no problem.

That's bad.

--
-C. Moya
www.cmoya.com
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2******* *********@TK2MS FTNGP06.phx.gbl ...
>>To set Option Strict

1. With your VB Web project open, click "Tools", then "Options".
2. Make sure the "Show all settings" box is selected.
3. Go to "Projects and Solutions", and scroll down to "VB defaults".

You'll see the "Default Project Settings" and the "Option Strict"
dropdown,
with "On" and "Off" choices.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============= =============== =======
"C. Moya" <cm*@nospam.com wrote in message
news:eD****** ********@TK2MSF TNGP04.phx.gbl. ..
I fully expected the lack of a way to set Option Strict globally to be
fixed in SP1. I can't seem
to figure out if it has been fixed or not. It still seems we have to add
the declaration at the
top
of each and every single code module. Am I missing something here?

--
-C. Moya
www.cmoya.com





Jan 18 '07 #8
Correct. If you have an existing VB project, you can set it in the project
project properties.

Mike.

"sticky" <st********@gma il.comwrote in message
news:11******** **************@ 11g2000cwr.goog legroups.com...
>I havent used VB.Net in a while, I only use C# nowadays, but I seem to
remember that if you want to set option strict globally you need to
open visual studio to the start page, with no project loaded and change
the option strict setting then. all new projects from then on will be
option strict by default.

worth a try, but as I said, I haven't used VB for a while

C. Moya wrote:
>I fully expected the lack of a way to set Option Strict globally to be
fixed
in SP1. I can't seem to figure out if it has been fixed or not. It still
seems we have to add the declaration at the top of each and every single
code module. Am I missing something here?

--
-C. Moya
www.cmoya.com



Jan 19 '07 #9
Sure... you can set it in many places... like Tools|Options and Project
Properties for WINFORMS apps (which works) and web.config for ASP.NET 2.0
projects. The problem is that it DOES NOT WORK for ASP.NET 2.0 projects.

Apparently, you have to manually insert Option Strict On at the top of each
and every code module in ASP.NET 2.0 projects.

I read this has something to do with 2.0's "project-less" infrastructure. ..
but it's still a bug nonetheless.

--
-C. Moya
www.cmoya.com
"Michael D. Ober" <obermd.@.alum. mit.edu.no.spam wrote in message
news:75******** **********@news read1.news.pas. earthlink.net.. .
Correct. If you have an existing VB project, you can set it in the
project project properties.

Mike.

"sticky" <st********@gma il.comwrote in message
news:11******** **************@ 11g2000cwr.goog legroups.com...
>>I havent used VB.Net in a while, I only use C# nowadays, but I seem to
remember that if you want to set option strict globally you need to
open visual studio to the start page, with no project loaded and change
the option strict setting then. all new projects from then on will be
option strict by default.

worth a try, but as I said, I haven't used VB for a while

C. Moya wrote:
>>I fully expected the lack of a way to set Option Strict globally to be
fixed
in SP1. I can't seem to figure out if it has been fixed or not. It still
seems we have to add the declaration at the top of each and every single
code module. Am I missing something here?

--
-C. Moya
www.cmoya.com




Jan 19 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2145
by: Microsoft News | last post by:
I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors. My question, should I even care about Option Strict? What advantages do I get with Option Strict On? Does better type statement make my code run faster? If anyone knows THE ANSWERS! please fill me in. I have ideas and belief but I would once and for all like to know what the...
11
2115
by: Daylor | last post by:
hi. im using option strict on. im doing in ,from the simple reason ,to be warn when there are implict conversion like string to int ,int to string. BUT. the price ,(now i see ), is very bad. if i have class CCar and interface ICar when im doing this : ICar = new CCar
8
1828
by: Rich | last post by:
Hello, If I leave Option Strict Off I can use the following syntax to read data from a Lotus Notes application (a NotesViewEntry object represents a row of data from a Lotus Notes View - like a record in a sql Server view) .... Dim entry As Domino.NotesViewEntry Dim obj As Object str1 = entry.ColumnValues(0)
17
4487
by: David | last post by:
Hi all, I have the following problem: my program works fine, but when I add option strict at the top of the form, the following sub fails with an error that option strict does not allow late binding. What should I do? Public Sub MyMnuHandler(ByVal sender As Object, ByVal e As System.EventArgs) If sender.checked = True Then sender.checked = False Else sender.checked = True
9
2338
by: YYZ | last post by:
After reading many messages in this group, it seems that the preferred setting for this is ON. Okay, I did that in my project (first with ..Net -- long time VB6 developer) and now a bunch of problems have cropped up. Most are easy to solve with using an explicit type cast cType(whatever, whatever type), but some aren't. Situation 1: I've got code that tries to get the itemkey of the selected item in a combobox....
15
1548
by: guy | last post by:
when i first started using .net (beta 1) i came across option strict and thought hey this could be really good, and since then have always turned it on, most people here seem to agree that this is a good thing. i have now been asked to debug a vb2005 web app for 3 weeks and there is no mention of option strict in it, (there are also no classes defined, just a couple of structures) everything is define as 'as object', data coming back...
18
2896
by: Poldie | last post by:
How do I turn it on? I'm using vb 2005 in visual studio 2005 sp1. In my web.config I have: <compilation debug="true" strict="true" /> In my Tools/Options/Projects and solutions/vb defaults I have option strict on. In my .vb file I have:
8
2425
by: Rory Becker | last post by:
A wise man once said: "Never put off until runtime what you can fix at compile time." Actually I think he said it about 10 minutes before I started this post. I am a firm believer, like the man in question, in "Option Strict On" by default. Actually I don't believe I have code where this is not the case.
8
3895
by: =?Utf-8?B?R3JlZw==?= | last post by:
We have an application in our office that has the Option Strict option set to off right now. I do understand it should be set to ON, but right now, I'm just going to continue with it this way since I do not have the time to fix everything to set it to ON. Anyway, my question is if its set to OFF why is it it keeps getting set back to ON, everytime we move the package from one machine to another. It's the Option Strict option specific to...
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9235
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.