I am using Visual Studio 2005 and am unable to use the “Using” statement. I have just moved some code over from a .net 4 application, but that does not seem to be the problem as it is still not usable in a new app.
Using sw as StreamWriter = new StreamWriter(userFile2)
For each blah as blahblah in blah()
sw.WriteLine(blah)
sw.Close()
End Using
Error = Using is not declared
I am lead to believe that it should work the exact same as in VB 2010.
Seems compile fine for me (VS 2005/.Net 2.0). You are missing
Nextfor theFor Each. Also you don’t have to explicitly callClose()forsw, theUsingblock take care of it.