473,320 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

problem in declaring streamwriter object

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


Jan 12 '06 #1
3 2128
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
Jan 12 '06 #2
"Karan" <ka******@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

Jan 12 '06 #3
Ooops... I jumped the gun. On reading the text again I realized you have
already imported IO

Ooops again
Jan 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: James | last post by:
Hi, I am new to .NET framework. I am trying to get data from the third party web application using WebHTTPRequest and Response class. I am getting TimeOut exception at GetResponse Method.. ...
1
by: Bob Hansen | last post by:
I am having a very strange problem with StreamWriter and writing to files. I have a procedure that is called several times to write out seperate files, each of them uniquely named by date all they...
0
by: Hawk Wu via DotNetMonster.com | last post by:
Hello, I have odd problem. When I close my application wait around 5 minute. The pocket of screen will show one message "System.Net.Sockets.Tcpclient" of message box. My source code as below. ...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
3
by: W Akthar | last post by:
Hi I am trying to create a windows service which queries SQL Server on timed intervals and depending on the results send appointments to Outlook. The problem lies when I try to create an...
1
by: Ryan Ternier | last post by:
I'm writing a file out using StreamWriter. What i'm outputting is a 6,398 lines of stupid Jscript arrays. Yes the system needs to be very very dynamic, and they don't want a page reload. The...
6
by: Don | last post by:
I'm having problems working with a streamwriter object. After closing the streamwriter and setting it to Nothing, I try to delete the file it was writing to, but I always get the following error...
1
by: asem0525 | last post by:
Hello guys, I have this kind of problem: first, the textBox tbISBN has a value that is read from the text file, but then after pressing the "Clear" button, it should be realized, and when I enter...
3
by: fniles | last post by:
I am using VB.NET 2005 and streamWriter to write to a file. Before writing to the file, I encrypt the string. StreamWriter does not write it correctly to the file, I have to change to FileOpen,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.