By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,104 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

Blasted parentheses!

P: n/a
In VS 2002 I could specify

Dim x As System.Windows.Forms.Form()

or

Dim x As System.Windows.Forms.Form

and everything was ok. Since upgrading to VS 2003 it won't
let me put in the parentheses in the above sample. After I
installed VS 2003 and opened up my 2002 project I answered
yes to the question about updating the project. Why didn't
it take my parens out?

Now I have a situation where some of my code has parens
and some don't. It seems that if I press Enter from a Try
statement, it goes through the code in that block and
takes them out for me but doesn't do anything anywhere
else.

Allowing this mixed mode type specification has led to
exceptions such as "Only one WebServiceBinding attribute
may be specified on type MyWebService" and other things.
It seems that I have to go through all my code to make
sure the parens are gone?

The VS 2003 docs show the parens as valid (see ms-
help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcn7/html/vaco
nWritingdeclarations.htm) yet the IDE doesn't allow them
and they didn't get converted at all. Am I missing
something or is there some easy way to fix this?

Jul 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Norm,
Are you missing something in your example?
Dim x As System.Windows.Forms.Form() is an array of forms
Dim x As System.Windows.Forms.Form is a single form.

Which in VS.NET 2002 are entirely different constructs.

In VS.NET 2002 there was a 'problem' when you had Operator New to create a
single Form:
Dim x As New System.Windows.Forms.Form()

And you deleted the Operator New keyword
Dim x As System.Windows.Forms.Form()

You were left with an array of forms.

Which causes all sorts of compile & runtime errors. Which sounds
suspiciously like your problem.

VS.NET 2003 changed it to remove the () on the constructor
Dim x As New System.Windows.Forms.Form

So when you delete the New keyword
Dim x As System.Windows.Forms.Form

You are still left with a single item.

I've only seen the parentheses disappear during upgrading when the Operator
New was involved.

I would recommend putting Option Strict On at the top of each source file,
you will receive compile errors instead of hard to track down runtime
errors. Of course you will receive additional errors where you are relying
on late binding.

Hope this helps
Jay

"Norm Dotti" <no***@knorrassociates.com> wrote in message
news:01****************************@phx.gbl... In VS 2002 I could specify

Dim x As System.Windows.Forms.Form()

or

Dim x As System.Windows.Forms.Form

and everything was ok. Since upgrading to VS 2003 it won't
let me put in the parentheses in the above sample. After I
installed VS 2003 and opened up my 2002 project I answered
yes to the question about updating the project. Why didn't
it take my parens out?

Now I have a situation where some of my code has parens
and some don't. It seems that if I press Enter from a Try
statement, it goes through the code in that block and
takes them out for me but doesn't do anything anywhere
else.

Allowing this mixed mode type specification has led to
exceptions such as "Only one WebServiceBinding attribute
may be specified on type MyWebService" and other things.
It seems that I have to go through all my code to make
sure the parens are gone?

The VS 2003 docs show the parens as valid (see ms-
help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcn7/html/vaco
nWritingdeclarations.htm) yet the IDE doesn't allow them
and they didn't get converted at all. Am I missing
something or is there some easy way to fix this?

Jul 19 '05 #2

P: n/a
Dim x As Type() declares an array. Dim x as Type declares it as an
object of that type. I don't know why it won't allow that, but I'd
suggest to declare array variables as Dim x() As Type to avoid
possible confusion (especially with the New keyword).

-mike
MVP

"Norm Dotti" <no***@knorrassociates.com> wrote in message
news:01****************************@phx.gbl...
In VS 2002 I could specify

Dim x As System.Windows.Forms.Form()

or

Dim x As System.Windows.Forms.Form

and everything was ok. Since upgrading to VS 2003 it won't
let me put in the parentheses in the above sample. After I
installed VS 2003 and opened up my 2002 project I answered
yes to the question about updating the project. Why didn't
it take my parens out?

Now I have a situation where some of my code has parens
and some don't. It seems that if I press Enter from a Try
statement, it goes through the code in that block and
takes them out for me but doesn't do anything anywhere
else.

Allowing this mixed mode type specification has led to
exceptions such as "Only one WebServiceBinding attribute
may be specified on type MyWebService" and other things.
It seems that I have to go through all my code to make
sure the parens are gone?

The VS 2003 docs show the parens as valid (see ms-
help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcn7/html/vaco
nWritingdeclarations.htm) yet the IDE doesn't allow them
and they didn't get converted at all. Am I missing
something or is there some easy way to fix this?

Jul 19 '05 #3

P: n/a
My bad. I meant to have the New keyword in there. I'm not
trying to do anything with an array nor have I removed a
New from the Dim statement.

So in 2002 it forced me to have:

Dim x As New System.Windows.Forms.Form()

In 2003 it forces me to have:

Dim x As New System.Windows.Forms.Form

Why didn't the upgrade wizard catch that? Is there some
way to have VS correct this for me rather than modifying
every Try block (essentially pressing Enter and then
Backspace to get it to go through and verify the code)?

Setting Option Strict On in the source file doesn't catch
this problem. I set Option Strict On in the project file
but I can't do that because I need to do late binding for
some things.

Any other ideas?
-----Original Message-----
Norm,
Are you missing something in your example?
Dim x As System.Windows.Forms.Form()is an array of forms
Dim x As System.Windows.Forms.Form

is a single form.

Which in VS.NET 2002 are entirely different constructs.

In VS.NET 2002 there was a 'problem' when you had

Operator New to create asingle Form:
Dim x As New System.Windows.Forms.Form()

And you deleted the Operator New keyword
Dim x As System.Windows.Forms.Form()

You were left with an array of forms.

Which causes all sorts of compile & runtime errors. Which soundssuspiciously like your problem.

VS.NET 2003 changed it to remove the () on the constructor
Dim x As New System.Windows.Forms.Form

So when you delete the New keyword
Dim x As System.Windows.Forms.Form

You are still left with a single item.

I've only seen the parentheses disappear during upgrading when the OperatorNew was involved.

I would recommend putting Option Strict On at the top of each source file,you will receive compile errors instead of hard to track down runtimeerrors. Of course you will receive additional errors where you are relyingon late binding.

Hope this helps
Jay

"Norm Dotti" <no***@knorrassociates.com> wrote in message
news:01****************************@phx.gbl...
In VS 2002 I could specify

Dim x As System.Windows.Forms.Form()

or

Dim x As System.Windows.Forms.Form

and everything was ok. Since upgrading to VS 2003 it won't let me put in the parentheses in the above sample. After I installed VS 2003 and opened up my 2002 project I answered yes to the question about updating the project. Why didn't it take my parens out?

Now I have a situation where some of my code has parens
and some don't. It seems that if I press Enter from a Try statement, it goes through the code in that block and
takes them out for me but doesn't do anything anywhere
else.

Allowing this mixed mode type specification has led to
exceptions such as "Only one WebServiceBinding attribute
may be specified on type MyWebService" and other things.
It seems that I have to go through all my code to make
sure the parens are gone?

The VS 2003 docs show the parens as valid (see ms-
help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcn7/html/vaco nWritingdeclarations.htm) yet the IDE doesn't allow them
and they didn't get converted at all. Am I missing
something or is there some easy way to fix this?

.

Jul 19 '05 #4

P: n/a
I didn't have any problems initially. It's run fine for
about a week now. It wasn't till I started changing code
(nothing that would have generated the exception I was
getting) that I started getting flakiness. One exception I
got was "only one WebServiceBinding attribute may be
specified on type MyWebService". Once I took the parens
off this particular Dim x as New webservice... it worked.

I don't really want to convert back. The update doesn't
take out the parens. I tried a simple app to verify. I
will contend that the upgrade should have removed them as
the IDE doesn't allow it (I understand you have to do
a "refresh" to get rid of them). So why the ambiguity?
Now, depending on what code you touch, some of your
statements have parens and some don't. Don't know that
this was causing the problems.

Do you know of any way to "refresh" an entire file?

Thanks.

-----Original Message-----
Norm,
No!

VS.NET 2003 fully support both:

Dim x As New System.Windows.Forms.Form()
Dim x As New System.Windows.Forms.Form

Well the compiler does anyway. The IDE will insist on removing the () on thefirst line, if you use Edit Undo right away it will come back, then usingthe mouse click someplace else it will stay, Run the program that line willwork as you expect. The () will stay until VS.NET 'refreshes' that block ofcode again.
It sounds like you have other problems going on, which is where OptionStrict On is your friend!

I have not heard of any projects, until yours, that failed to compile fromVS.NET 2002 to VS.NET 2003. What else have you done to the project (search &replace?)?

Do you have a copy in Source Safe, can you compare the last version fromVS.NET 2002 to the first version from VS.NET 2003?

If you haven't modified too much source in VS.NET 2003 there is a utility onCode Project that will convert the project & solution from VS.NET 2003, backto VS.NET 2002. If you haven't really made any changes, convert it back, andsee if it still works in 2002. If you modified both, I'm concerned it willbe broken in both environments.

http://www.codeproject.com/macro/vsconvert.asp

Hope this helps
Jay

"Norm Dotti" <no***@knorrassociates.com> wrote in message
news:0b****************************@phx.gbl...
My bad. I meant to have the New keyword in there. I'm not
trying to do anything with an array nor have I removed a
New from the Dim statement.

So in 2002 it forced me to have:

Dim x As New System.Windows.Forms.Form()

In 2003 it forces me to have:

Dim x As New System.Windows.Forms.Form

Why didn't the upgrade wizard catch that? Is there some
way to have VS correct this for me rather than modifying
every Try block (essentially pressing Enter and then
Backspace to get it to go through and verify the code)?

Setting Option Strict On in the source file doesn't catch this problem. I set Option Strict On in the project file
but I can't do that because I need to do late binding for some things.

Any other ideas?
>-----Original Message-----
>Norm,
>Are you missing something in your example?
>
>> Dim x As System.Windows.Forms.Form()
>is an array of forms
>
>> Dim x As System.Windows.Forms.Form
>is a single form.
>
>Which in VS.NET 2002 are entirely different constructs.
>
>In VS.NET 2002 there was a 'problem' when you had

Operator New to create a
>single Form:
> Dim x As New System.Windows.Forms.Form()
>
>And you deleted the Operator New keyword
> Dim x As System.Windows.Forms.Form()
>
>You were left with an array of forms.
>
>Which causes all sorts of compile & runtime errors. Which
sounds
>suspiciously like your problem.
>
>VS.NET 2003 changed it to remove the () on the
constructor > Dim x As New System.Windows.Forms.Form
>
>So when you delete the New keyword
> Dim x As System.Windows.Forms.Form
>
>You are still left with a single item.
>
>I've only seen the parentheses disappear during upgrading when the Operator
>New was involved.
>
>I would recommend putting Option Strict On at the top
of each source file,
>you will receive compile errors instead of hard to
track down runtime
>errors. Of course you will receive additional errors

where you are relying
>on late binding.
>
>Hope this helps
>Jay
>
>"Norm Dotti" <no***@knorrassociates.com> wrote in

message >news:01****************************@phx.gbl...
>> In VS 2002 I could specify
>>
>> Dim x As System.Windows.Forms.Form()
>>
>> or
>>
>> Dim x As System.Windows.Forms.Form
>>
>> and everything was ok. Since upgrading to VS 2003 it

won't
>> let me put in the parentheses in the above sample.

After I
>> installed VS 2003 and opened up my 2002 project I

answered
>> yes to the question about updating the project. Why

didn't
>> it take my parens out?
>>
>> Now I have a situation where some of my code has parens >> and some don't. It seems that if I press Enter from a

Try
>> statement, it goes through the code in that block and
>> takes them out for me but doesn't do anything anywhere >> else.
>>
>> Allowing this mixed mode type specification has led to >> exceptions such as "Only one WebServiceBinding attribute >> may be specified on type MyWebService" and other things. >> It seems that I have to go through all my code to make >> sure the parens are gone?
>>
>> The VS 2003 docs show the parens as valid (see ms-
>>

help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcn7/html/vaco
>> nWritingdeclarations.htm) yet the IDE doesn't allow them >> and they didn't get converted at all. Am I missing
>> something or is there some easy way to fix this?
>>
>
>
>.
>

.

Jul 19 '05 #5

P: n/a
Norm,
I'm running .NET 1.1, whether I include the () or not on the construction of
the object (operator new), I do not receive runtime errors!

If you want to really find the problem use Option Strict On! Which means you
need to stop relying on Late Binding. Normally I isolate my Late Binding
into one small corner of my application that I do not include Option Strict
On, for when I really need Late Binding.

If you get a reproducible sample, I can try it, just to make sure its not
something odd with your machine. Or that it is something that we need to
report as a bug.

Hope this helps
Jay
"Norm Dotti" <no***@knorrassociates.com> wrote in message
news:0b****************************@phx.gbl...
The compiler may not care but the CLR somehow does (mine
were runtime errors). This has happened for multiple
developers here, so it's not a particular machine. I'm
going to work on a reproducable sample (this is always the
fun part!). I'll let you know my findings. Thanks for your
input and suggestions.

-----Original Message-----
Norm,
the IDE doesn't allow it (I understand you have to do
a "refresh" to get rid of them). So why the ambiguity?

Which ambiguity? that some have it & some don't? The

compiler itself doesn't
care! So it really doesn't bother me in my files...
Do you know of any way to "refresh" an entire file?

Directly No. If you are extremely careful, you should be

able to use "Edit -
Find and Replace - Replace in Files" to search for

all "New {:i}\(\)" and
replace with "New \1", which is using regular expressions

to search for all
new MyObject() and replacing with New MyObject, where its

any class name.
Double check the expressions.

Again just be very extremely careful as using regular

expressions in Replace
is Files (especially w/Replace All) is very much

the "weapons of mass
destruction" approach of changing code. I normally ensure

that i have the
"keep modified files open after Replace All" so I have

the ability to undo
the change.

However! I really don't think the () is the real problem

here...

Hope this helps
Jay

"Norm Dotti" <no***@knorrassociates.com> wrote in message
news:04****************************@phx.gbl...
I didn't have any problems initially. It's run fine for
about a week now. It wasn't till I started changing code
(nothing that would have generated the exception I was
getting) that I started getting flakiness. One exception I got was "only one WebServiceBinding attribute may be
specified on type MyWebService". Once I took the parens
off this particular Dim x as New webservice... it worked.
I don't really want to convert back. The update doesn't
take out the parens. I tried a simple app to verify. I
will contend that the upgrade should have removed them as the IDE doesn't allow it (I understand you have to do
a "refresh" to get rid of them). So why the ambiguity?
Now, depending on what code you touch, some of your
statements have parens and some don't. Don't know that
this was causing the problems.

Do you know of any way to "refresh" an entire file?

Thanks.
>-----Original Message-----
>Norm,
>No!
>
>VS.NET 2003 fully support both:
>
> Dim x As New System.Windows.Forms.Form()
> Dim x As New System.Windows.Forms.Form
>
>Well the compiler does anyway. The IDE will insist on
removing the () on the
>first line, if you use Edit Undo right away it will come back, then using
>the mouse click someplace else it will stay, Run the
program that line will
>work as you expect. The () will stay until
VS.NET 'refreshes' that block of
>code again.
>
>
>It sounds like you have other problems going on, which is where Option
>Strict On is your friend!
>
>I have not heard of any projects, until yours, that
failed to compile from
>VS.NET 2002 to VS.NET 2003. What else have you done to
the project (search &
>replace?)?
>
>Do you have a copy in Source Safe, can you compare the
last version from
>VS.NET 2002 to the first version from VS.NET 2003?
>
>If you haven't modified too much source in VS.NET 2003
there is a utility on
>Code Project that will convert the project & solution
from VS.NET 2003, back
>to VS.NET 2002. If you haven't really made any changes,
convert it back, and
>see if it still works in 2002. If you modified both, I'm concerned it will
>be broken in both environments.
>
>http://www.codeproject.com/macro/vsconvert.asp
>
>Hope this helps
>Jay
>
>"Norm Dotti" <no***@knorrassociates.com> wrote in message >news:0b****************************@phx.gbl...
>> My bad. I meant to have the New keyword in there. I'm
not
>> trying to do anything with an array nor have I removed a >> New from the Dim statement.
>>
>> So in 2002 it forced me to have:
>>
>> Dim x As New System.Windows.Forms.Form()
>>
>> In 2003 it forces me to have:
>>
>> Dim x As New System.Windows.Forms.Form
>>
>> Why didn't the upgrade wizard catch that? Is there some >> way to have VS correct this for me rather than modifying >> every Try block (essentially pressing Enter and then
>> Backspace to get it to go through and verify the code)? >>
>> Setting Option Strict On in the source file doesn't
catch
>> this problem. I set Option Strict On in the project file >> but I can't do that because I need to do late binding
for
>> some things.
>>
>> Any other ideas?
>>
>> >-----Original Message-----
>> >Norm,
>> >Are you missing something in your example?
>> >
>> >> Dim x As System.Windows.Forms.Form()
>> >is an array of forms
>> >
>> >> Dim x As System.Windows.Forms.Form
>> >is a single form.
>> >
>> >Which in VS.NET 2002 are entirely different constructs. >> >
>> >In VS.NET 2002 there was a 'problem' when you had
>> Operator New to create a
>> >single Form:
>> > Dim x As New System.Windows.Forms.Form()
>> >
>> >And you deleted the Operator New keyword
>> > Dim x As System.Windows.Forms.Form()
>> >
>> >You were left with an array of forms.
>> >
>> >Which causes all sorts of compile & runtime errors.
Which
>> sounds
>> >suspiciously like your problem.
>> >
>> >VS.NET 2003 changed it to remove the () on the
constructor
>> > Dim x As New System.Windows.Forms.Form
>> >
>> >So when you delete the New keyword
>> > Dim x As System.Windows.Forms.Form
>> >
>> >You are still left with a single item.
>> >
>> >I've only seen the parentheses disappear during
upgrading
>> when the Operator
>> >New was involved.
>> >
>> >I would recommend putting Option Strict On at the top of
>> each source file,
>> >you will receive compile errors instead of hard to
track
>> down runtime
>> >errors. Of course you will receive additional errors
>> where you are relying
>> >on late binding.
>> >
>> >Hope this helps
>> >Jay
>> >
>> >"Norm Dotti" <no***@knorrassociates.com> wrote in
message
>> >news:01****************************@phx.gbl...
>> >> In VS 2002 I could specify
>> >>
>> >> Dim x As System.Windows.Forms.Form()
>> >>
>> >> or
>> >>
>> >> Dim x As System.Windows.Forms.Form
>> >>
>> >> and everything was ok. Since upgrading to VS 2003 it >> won't
>> >> let me put in the parentheses in the above sample.
>> After I
>> >> installed VS 2003 and opened up my 2002 project I
>> answered
>> >> yes to the question about updating the project. Why >> didn't
>> >> it take my parens out?
>> >>
>> >> Now I have a situation where some of my code has
parens
>> >> and some don't. It seems that if I press Enter from a >> Try
>> >> statement, it goes through the code in that block and >> >> takes them out for me but doesn't do anything
anywhere
>> >> else.
>> >>
>> >> Allowing this mixed mode type specification has led to
>> >> exceptions such as "Only one WebServiceBinding
attribute
>> >> may be specified on type MyWebService" and other
things.
>> >> It seems that I have to go through all my code to
make
>> >> sure the parens are gone?
>> >>
>> >> The VS 2003 docs show the parens as valid (see ms-
>> >>
>>
help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcn7/html/vaco >> >> nWritingdeclarations.htm) yet the IDE doesn't allow them
>> >> and they didn't get converted at all. Am I missing
>> >> something or is there some easy way to fix this?
>> >>
>> >
>> >
>> >.
>> >
>
>
>.
>

.

Jul 19 '05 #6

P: n/a
Sigh...as it turns out, this was far less reproducable
than I was originally led to believe. In reality, it
happened twice and is not in fact reproducable at this
point.

We are using VSS and I was able to revert back to the
version of the code that exhibited the problem, but today
the binary gods were working in my favor and it didn't
cause a problem. I tried it from three different machines,
including the one that got the runtime exception
yesterday. We will continue to monitor this behavior to
see if it happens again. For now, I'll consider it a fluke
and move on.

We have not upgraded VSS to 6.0d from 6.0c. Are there any
compelling reasons to do so?

Thanks for your help Jay.

-----Original Message-----
Norm,
I'm running .NET 1.1, whether I include the () or not on the construction ofthe object (operator new), I do not receive runtime errors!
If you want to really find the problem use Option Strict On! Which means youneed to stop relying on Late Binding. Normally I isolate my Late Bindinginto one small corner of my application that I do not include Option StrictOn, for when I really need Late Binding.

If you get a reproducible sample, I can try it, just to make sure its notsomething odd with your machine. Or that it is something that we need toreport as a bug.

Hope this helps
Jay
"Norm Dotti" <no***@knorrassociates.com> wrote in message
news:0b****************************@phx.gbl...
The compiler may not care but the CLR somehow does (mine
were runtime errors). This has happened for multiple
developers here, so it's not a particular machine. I'm
going to work on a reproducable sample (this is always the
fun part!). I'll let you know my findings. Thanks for your input and suggestions.

>-----Original Message-----
>Norm,
>> the IDE doesn't allow it (I understand you have to do
>> a "refresh" to get rid of them). So why the ambiguity? >Which ambiguity? that some have it & some don't? The

compiler itself doesn't
>care! So it really doesn't bother me in my files...
>
>> Do you know of any way to "refresh" an entire file?
>Directly No. If you are extremely careful, you should be
able to use "Edit -
>Find and Replace - Replace in Files" to search for

all "New {:i}\(\)" and
>replace with "New \1", which is using regular
expressions to search for all
>new MyObject() and replacing with New MyObject, where
its any class name.
>Double check the expressions.
>
>Again just be very extremely careful as using regular

expressions in Replace
>is Files (especially w/Replace All) is very much

the "weapons of mass
>destruction" approach of changing code. I normally
ensure that i have the
>"keep modified files open after Replace All" so I have

the ability to undo
>the change.
>
>However! I really don't think the () is the real
problem here...
>
>Hope this helps
>Jay
>
>"Norm Dotti" <no***@knorrassociates.com> wrote in
message >news:04****************************@phx.gbl...
>> I didn't have any problems initially. It's run fine for >> about a week now. It wasn't till I started changing code >> (nothing that would have generated the exception I was >> getting) that I started getting flakiness. One

exception I
>> got was "only one WebServiceBinding attribute may be
>> specified on type MyWebService". Once I took the parens >> off this particular Dim x as New webservice... it

worked.
>>
>> I don't really want to convert back. The update doesn't >> take out the parens. I tried a simple app to verify. I >> will contend that the upgrade should have removed them as
>> the IDE doesn't allow it (I understand you have to do
>> a "refresh" to get rid of them). So why the
ambiguity? >> Now, depending on what code you touch, some of your
>> statements have parens and some don't. Don't know that >> this was causing the problems.
>>
>> Do you know of any way to "refresh" an entire file?
>>
>> Thanks.
>>
>>
>> >-----Original Message-----
>> >Norm,
>> >No!
>> >
>> >VS.NET 2003 fully support both:
>> >
>> > Dim x As New System.Windows.Forms.Form()
>> > Dim x As New System.Windows.Forms.Form
>> >
>> >Well the compiler does anyway. The IDE will insist on >> removing the () on the
>> >first line, if you use Edit Undo right away it will

come
>> back, then using
>> >the mouse click someplace else it will stay, Run the
>> program that line will
>> >work as you expect. The () will stay until
>> VS.NET 'refreshes' that block of
>> >code again.
>> >
>> >
>> >It sounds like you have other problems going on, which is
>> where Option
>> >Strict On is your friend!
>> >
>> >I have not heard of any projects, until yours, that
>> failed to compile from
>> >VS.NET 2002 to VS.NET 2003. What else have you done
to >> the project (search &
>> >replace?)?
>> >
>> >Do you have a copy in Source Safe, can you compare the >> last version from
>> >VS.NET 2002 to the first version from VS.NET 2003?
>> >
>> >If you haven't modified too much source in VS.NET 2003 >> there is a utility on
>> >Code Project that will convert the project & solution >> from VS.NET 2003, back
>> >to VS.NET 2002. If you haven't really made any changes, >> convert it back, and
>> >see if it still works in 2002. If you modified both,

I'm
>> concerned it will
>> >be broken in both environments.
>> >
>> >http://www.codeproject.com/macro/vsconvert.asp
>> >
>> >Hope this helps
>> >Jay
>> >
>> >"Norm Dotti" <no***@knorrassociates.com> wrote in

message
>> >news:0b****************************@phx.gbl...
>> >> My bad. I meant to have the New keyword in there. I'm >> not
>> >> trying to do anything with an array nor have I

removed a
>> >> New from the Dim statement.
>> >>
>> >> So in 2002 it forced me to have:
>> >>
>> >> Dim x As New System.Windows.Forms.Form()
>> >>
>> >> In 2003 it forces me to have:
>> >>
>> >> Dim x As New System.Windows.Forms.Form
>> >>
>> >> Why didn't the upgrade wizard catch that? Is there

some
>> >> way to have VS correct this for me rather than

modifying
>> >> every Try block (essentially pressing Enter and then >> >> Backspace to get it to go through and verify the

code)?
>> >>
>> >> Setting Option Strict On in the source file doesn't >> catch
>> >> this problem. I set Option Strict On in the project file
>> >> but I can't do that because I need to do late
binding >> for
>> >> some things.
>> >>
>> >> Any other ideas?
>> >>
>> >> >-----Original Message-----
>> >> >Norm,
>> >> >Are you missing something in your example?
>> >> >
>> >> >> Dim x As System.Windows.Forms.Form()
>> >> >is an array of forms
>> >> >
>> >> >> Dim x As System.Windows.Forms.Form
>> >> >is a single form.
>> >> >
>> >> >Which in VS.NET 2002 are entirely different

constructs.
>> >> >
>> >> >In VS.NET 2002 there was a 'problem' when you had
>> >> Operator New to create a
>> >> >single Form:
>> >> > Dim x As New System.Windows.Forms.Form()
>> >> >
>> >> >And you deleted the Operator New keyword
>> >> > Dim x As System.Windows.Forms.Form()
>> >> >
>> >> >You were left with an array of forms.
>> >> >
>> >> >Which causes all sorts of compile & runtime errors. >> Which
>> >> sounds
>> >> >suspiciously like your problem.
>> >> >
>> >> >VS.NET 2003 changed it to remove the () on the
>> constructor
>> >> > Dim x As New System.Windows.Forms.Form
>> >> >
>> >> >So when you delete the New keyword
>> >> > Dim x As System.Windows.Forms.Form
>> >> >
>> >> >You are still left with a single item.
>> >> >
>> >> >I've only seen the parentheses disappear during
>> upgrading
>> >> when the Operator
>> >> >New was involved.
>> >> >
>> >> >I would recommend putting Option Strict On at the

top
>> of
>> >> each source file,
>> >> >you will receive compile errors instead of hard to >> track
>> >> down runtime
>> >> >errors. Of course you will receive additional errors >> >> where you are relying
>> >> >on late binding.
>> >> >
>> >> >Hope this helps
>> >> >Jay
>> >> >
>> >> >"Norm Dotti" <no***@knorrassociates.com> wrote in
>> message
>> >> >news:01****************************@phx.gbl...
>> >> >> In VS 2002 I could specify
>> >> >>
>> >> >> Dim x As System.Windows.Forms.Form()
>> >> >>
>> >> >> or
>> >> >>
>> >> >> Dim x As System.Windows.Forms.Form
>> >> >>
>> >> >> and everything was ok. Since upgrading to VS 2003 it
>> >> won't
>> >> >> let me put in the parentheses in the above
sample. >> >> After I
>> >> >> installed VS 2003 and opened up my 2002 project I >> >> answered
>> >> >> yes to the question about updating the project.

Why
>> >> didn't
>> >> >> it take my parens out?
>> >> >>
>> >> >> Now I have a situation where some of my code has >> parens
>> >> >> and some don't. It seems that if I press Enter

from a
>> >> Try
>> >> >> statement, it goes through the code in that block and
>> >> >> takes them out for me but doesn't do anything
>> anywhere
>> >> >> else.
>> >> >>
>> >> >> Allowing this mixed mode type specification has

led
>> to
>> >> >> exceptions such as "Only one WebServiceBinding
>> attribute
>> >> >> may be specified on type MyWebService" and

other >> things.
>> >> >> It seems that I have to go through all my code to >> make
>> >> >> sure the parens are gone?
>> >> >>
>> >> >> The VS 2003 docs show the parens as valid (see ms- >> >> >>
>> >>
>>

help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcn7/html/vaco
>> >> >> nWritingdeclarations.htm) yet the IDE doesn't

allow
>> them
>> >> >> and they didn't get converted at all. Am I missing >> >> >> something or is there some easy way to fix this? >> >> >>
>> >> >
>> >> >
>> >> >.
>> >> >
>> >
>> >
>> >.
>> >
>
>
>.
>

.

Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.