Home All Groups Group Topic Archive Search About

problem in declaring streamwriter object

Author
12 Jan 2006 3:29 AM
Karan
I have already imported system.io. Reader object is working fine: Dim sr As
New StreamReader(fstream). Writer object
Dim sw As New StreamWriter(fstream) object shows blue under line with type
expected on hovering the mouse. However, when I create object like this  Dim
sw As New IO.StreamWriter(fstream) it works fine.

Why this is happening!

Thank you

waiting for reply

Karan

Author
12 Jan 2006 10:37 AM
Armin Zingler
"Karan" <karan***@hotmail.com> schrieb
> I have already imported system.io. Reader object is working fine:
> Dim sr As New StreamReader(fstream). Writer object
> Dim sw As New StreamWriter(fstream) object shows blue under line
> with type expected on hovering the mouse. However, when I create
> object like this  Dim sw As New IO.StreamWriter(fstream) it works
> fine.
>
> Why this is happening!


User "go to definition" (from the context menu) on the word "Streamwriter".
What happens?


Armin
Author
12 Jan 2006 10:48 AM
Cyril Gupta
The classes under the IO namespace are not in the global namespace by
default. To access them you have to qualify them with the IO namespace
before them.

If you want to include them in the global namespace make this the first line
of your module

Imports System.IO

This should be before everything else in your code.

Regards
Cyril Gupta
Author
12 Jan 2006 11:00 AM
Cyril Gupta
Ooops... I jumped the gun. On reading the text again I realized you have
already imported IO

Ooops again