problem in declaring streamwriter object

K

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
 
A

Armin Zingler

Karan said:
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
 
C

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
 
C

Cyril Gupta

Ooops... I jumped the gun. On reading the text again I realized you have
already imported IO

Ooops again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top