my for each ... as ... thing is broken

  • Thread starter Thread starter Tom Leylan
  • Start date Start date
T

Tom Leylan

Does anybody have any idea why my version of VS.Net doesn't accept the
following syntax?

For Each f As FileInfo In d.GetFiles()
sz += f.Length
Next f

I always have to explicitly declare the variable as follows:

Dim f As FileInfo

For Each f In d.GetFiles()
sz += f.Length
Next f

Even the example given in the MSDN online help on For... Next doesn't
compile without an error. I looked around for some setting but there
doesn't seem to be one and I seem to have all the updates installed.
 
Tom said:
Does anybody have any idea why my version of VS.Net doesn't accept the
following syntax?

For Each f As FileInfo In d.GetFiles()
sz += f.Length
Next f

I always have to explicitly declare the variable as follows:

Dim f As FileInfo

For Each f In d.GetFiles()
sz += f.Length
Next f

Even the example given in the MSDN online help on For... Next doesn't
compile without an error. I looked around for some setting but there
doesn't seem to be one and I seem to have all the updates installed.

I believe that is new feature of .Net 1.1 and vs.net2003 only.
 
Hi Tom,

VB.net 2003
For Each f As FileInfo In d.GetFiles()
sz += f.Length
Next f

I always have to explicitly declare the variable as follows:

VB.net 2002
Dim f As FileInfo

For Each f In d.GetFiles()
sz += f.Length
Next f

Therefore I give all my examples in VB.net 2002 style while I am using 2003

Happy to help especialy you.

Cor
 
Tom Leylan said:
Does anybody have any idea why my version of VS.Net doesn't accept
the following syntax?

For Each f As FileInfo In d.GetFiles()
sz += f.Length
Next f

I always have to explicitly declare the variable as follows:

Dim f As FileInfo

For Each f In d.GetFiles()
sz += f.Length
Next f

Even the example given in the MSDN online help on For... Next
doesn't compile without an error. I looked around for some setting
but there doesn't seem to be one and I seem to have all the updates
installed.

2002 and 2003 version installed? Whenever the project is opened in the
explorer, the right version is started, i.e. a 2002 project starts VB 2002.
(VB IDE: menu help->Info) ;)
 
Slonocode said:
I believe that is new feature of .Net 1.1 and vs.net2003 only.

That pinpointed the problem (thanks) now... I'm looking around the net but
would you have an idea how I can clean up the .Net mess I have on my machine
:-)

I appear to have Version 1.0.3705 with a reported size of 1,721MB
I appear ot have Version 1.1 with a reported size of 37MB

and strangely VS Studio is reporting it's size as 1,721MB also (seems like
something more than a coincidence)

Is there a clean way to eliminate the unneeded stuff and have a working VB
Studio with .Net 1.1 that you are aware of?

Thanks,
Tom
 
Tom Leylan wrote:

I appear to have Version 1.0.3705 with a reported size of 1,721MB
I appear ot have Version 1.1 with a reported size of 37MB

and strangely VS Studio is reporting it's size as 1,721MB also (seems
like something more than a coincidence)

Is there a clean way to eliminate the unneeded stuff and have a
working VB Studio with .Net 1.1 that you are aware of?

Thanks,
Tom

Tom I'm not sure about the sizes.
But it is not a problem to have both versions of .Net on the same machine so
that you can run applications that need 1.1. I don't think you can develop
with .Net 1.1 without upgrading to VS2003.
 
Armin Zingler said:
2002 and 2003 version installed? Whenever the project is opened in the
explorer, the right version is started, i.e. a 2002 project starts VB 2002.
(VB IDE: menu help->Info) ;)

Well that's it. It turns out I have VS 2000 and despite having the 1.1
framework it is referencing the 1.0 framework. I suppose I must have missed
an upgrade announcement or something :-)

A bit funny that the "check for updates" didn't tell me there was a new
version. A missed "sales opportunity" it would seem.

Also... there isn't any reason to actually have both versions and both
frameworks is there?

Thanks,
Tom
 
The size issue is a glitch with Windows Installer that sometimes occurs when
two applications are installed together -- Windows reports the size of the
larger application for both installations. The Framework isn't actually
taking 1.7 GB of space your disk.
 
* "Tom Leylan said:
Does anybody have any idea why my version of VS.Net doesn't accept the
following syntax?

For Each f As FileInfo In d.GetFiles()
sz += f.Length
Next f

I always have to explicitly declare the variable as follows:

Dim f As FileInfo

For Each f In d.GetFiles()
sz += f.Length
Next f

Even the example given in the MSDN online help on For... Next doesn't
compile without an error. I looked around for some setting but there
doesn't seem to be one and I seem to have all the updates installed.

"Inline declarations" will only work with VB.NET 2003, not VB.NET 2002.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
* "Tom Leylan said:
That pinpointed the problem (thanks) now... I'm looking around the net but
would you have an idea how I can clean up the .Net mess I have on my machine
:-)

I appear to have Version 1.0.3705 with a reported size of 1,721MB
I appear ot have Version 1.1 with a reported size of 37MB

and strangely VS Studio is reporting it's size as 1,721MB also (seems like
something more than a coincidence)

Is there a clean way to eliminate the unneeded stuff and have a working VB
Studio with .Net 1.1 that you are aware of?

If you are using VS.NET 2002: There is no way to get it work with .NET
1.1, you will have to upgrade to VS.NET 2003.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
Tom,
As the others have mentioned.

VS.NET 2002 requires & can only use .NET 1.0.

VS.NET 2003 requires & can only use .NET 1.1. VS.NET 2003 does have an
option that will set the app.config so your executable can run on .NET 1.0,
however it requires .NET 1.1 to compile said executable.

Check for updates never detected VS.NET 2003 as its not an update per se.

Hope this helps
Jay
 
Jay B. Harlow said:
Check for updates never detected VS.NET 2003 as its not an update per se.

Hi Jay: I think I'm clear on this (relatively speaking of course) now...
and while it isn't an "upgrade" it is a lost selling opportunity. I would
have upgraded long ago if I had been paying attention or I new that a new
"required" version was released.

I assumed (incorrectly) that I was working with the latest framework because
I had installed it.
 
Tom Leylan wrote:



Tom I'm not sure about the sizes.
But it is not a problem to have both versions of .Net on the same machine so
that you can run applications that need 1.1. I don't think you can develop
with .Net 1.1 without upgrading to VS2003.

Technically, you can :) You just can't use VS.NET....
 
Tom said:
Also... there isn't any reason to actually have both versions and both
frameworks is there?

Thanks,
Tom

The .Net framework was designed so that you could have multiple versions on
the same machine.
Part of the reason it is designed that way is to help eliminate the so
called "DLL Hell" issue.

VS will use the appropriate version of the framework and its not a problem
to have multiple versions of VS installed either.
 
Slonocode said:
Part of the reason it is designed that way is to help eliminate the so
called "DLL Hell" issue.

And that seems to be working out well. How ironic that we're finally
returning to the flexibility we had in MS-DOS :-)
VS will use the appropriate version of the framework and its not a problem
to have multiple versions of VS installed either.

I was just curious why I would want to develop in 1.0 if I had 1.1. It's
upwardly compatible so old code will run in 1.1 just as easily. I'm getting
inundated with "version creep" these days.

Tom
 
Armin Zingler said:
2002 and 2003 version installed? Whenever the project is opened in
the explorer, the right version is started, i.e. a 2002 project
starts VB 2002. (VB IDE: menu help->Info) ;)

BTW, I still use the old version (no "inline" declaration) because the
right-click on the inline type and selecting "go to definition" does not
work.

;-)
 
Armin Zingler said:
BTW, I still use the old version (no "inline" declaration) because the
right-click on the inline type and selecting "go to definition" does not
work.

Armin: That's good to know. I somewhat doubt that I'll go to the inline
variation (though I might) I just didn't know why mine didn't work. I
assume there are other benefits of upgrading. :-)
 
Back
Top