473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Blasted parentheses!

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
6 1500
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: seberino | last post by:
Tuples are defined with regards to parentheses ()'s as everyone knows. This causes confusion for 1 item tuples since (5) can be interpreted as a tuple OR as the number 5 in a mathematical...
3
by: Jane Doe | last post by:
Hello, I need to browse a list of hyperlinks, each followed by an author, and remove the links only for certain authors. 1. I searched the archives on Google, but didn't find how to tell the...
6
by: KathyB | last post by:
Hi, I'm passing a parameter to a script, which sometimes fails. However, I discovered that the ones failing had parentheses within the text string, e.g., "Step: Press the (0) on the console." ...
6
by: Michael Winter | last post by:
I'll be frank: what is the point? The use, and usefulness, of a set of capturing parentheses in a regular expression is clear. However, isn't an expression such as "/(?:x)/", exactly the same as...
6
by: Norm Dotti | last post by:
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...
4
by: Thelma Lubkin | last post by:
I've inherited code with SELECT statements that look like this one: SELECT tblSales.YEAR As , Count(tblSales.UNITS) As FROM INNER JOIN tblSales ON .STFID = tblSales.STFID WHERE...
3
by: Lyn | last post by:
Can anyone explain this for me? A sub procedure can be called with or without parentheses around the arguments. By personal convention, I normally use parentheses. I am in the middle of a...
3
by: Helen Wheels | last post by:
Can we use parentheses in a check constraint in MS-SQL-server DDL? e.g. I'm having a problem with the following statement: ALTER TABLE . ADD CONSTRAINT CHECK (( IS NULL AND IS NULL) OR (...
7
by: vlsidesign | last post by:
I am not sure how to think about parentheses. It seems when they are used alongside characters it indicates a function, like addTwoNums(). But is also is used to enforce which operators and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.