For Loop difference between vb2005 and vb2010 carries over in converted projects

22-degrees

Well-known member
Joined
Feb 11, 2012
Messages
156
Location
South East Ireland
Programming Experience
1-3
In vbExpress2005 I have to declare the integer to use the for loop in one of 2 (that I know) ways:

Dim i as integer
For i = 1 to 10

Next


or

For i as integer = 1 to 10

Next




In vbExpress2010 it is a simpler:

For i = 1 to 10

Next



Today I re-opened an old vb2005 project and converted it to 2010 through the built in conversion feature.

However i notice that I can't use the simple for loop as I can in non converted vb2010 projects.. I still have to use the extra code to declare the integer.

Is this a natural thing or is there something I am not doing right?
 
Hi,

I have never used VB2005, but it sounds like the conversion has carried over an "Option Infer Off" statement. On the basis that you did not have this option in 2005 it seems to make sense.

I would suggest that you check your Option Settings for the project or add "Option Infer On" and all should be sorted.

Cheers,

Ian
 
Back
Top