473,325 Members | 2,792 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,325 software developers and data experts.

questions about writing files

Hi,

I want to do the following:

declare a file stream and a writer in subroutine A
and perform the actual write operation in subroutine B.

How should I do it ?

( I believe this should be simple, but I am novice to vb.net )

TIA

Larry

Nov 21 '05 #1
4 828
"Larry Chen" <lc*********@comcast.net> schrieb:
I want to do the following:

declare a file stream and a writer in subroutine A
and perform the actual write operation in subroutine B.


\\\
Private m_Writer As StreamWriter

Private Sub A()
m_Writer = New StreamWriter(...)
B()
End Sub

Private Sub B()
m_Writer.WriteLine(...)
End Sub
///

- or -

\\\
Private Sub A()
Dim Writer As New StreamWriter(...)
B(Writer)
End Sub

Private Sub B(ByVal Writer As StreamWriter)
Writer.WriteLine(...)
End Sub
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #2
or

Private Sub A()
Private m_Writer As StreamWriter
m_Writer = New StreamWriter(...)
B()
End Sub

Private Sub B(m as StreamWriter)
m_Writer.WriteLine(...)
End Sub

"Herfried K. Wagner [MVP]" wrote:
"Larry Chen" <lc*********@comcast.net> schrieb:
I want to do the following:

declare a file stream and a writer in subroutine A
and perform the actual write operation in subroutine B.


\\\
Private m_Writer As StreamWriter

Private Sub A()
m_Writer = New StreamWriter(...)
B()
End Sub

Private Sub B()
m_Writer.WriteLine(...)
End Sub
///

- or -

\\\
Private Sub A()
Dim Writer As New StreamWriter(...)
B(Writer)
End Sub

Private Sub B(ByVal Writer As StreamWriter)
Writer.WriteLine(...)
End Sub
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #3

"Dennis" <De****@discussions.microsoft.com> wrote

Private Sub A()
Private m_Writer As StreamWriter
m_Writer = New StreamWriter(...)
B()
End Sub

Private Sub B(m as StreamWriter)
m_Writer.WriteLine(...)
End Sub


What is missing from this picture?

<g>
LFS

Nov 21 '05 #4
The m_Writer in the b() !

"Larry Serflaten" wrote:

"Dennis" <De****@discussions.microsoft.com> wrote

Private Sub A()
Private m_Writer As StreamWriter
m_Writer = New StreamWriter(...)
B()
End Sub

Private Sub B(m as StreamWriter)
m_Writer.WriteLine(...)
End Sub


What is missing from this picture?

<g>
LFS

Nov 21 '05 #5

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

Similar topics

7
by: Martin | last post by:
Again drawing on the groups experience:- 1. For general file opening and file saving, using VB6, are there any issues with using the FileOpen and FileSave Common Dialog Boxes? 2. Is using the...
48
by: Joseph | last post by:
Hi I'm writing a commercial program which must be reliable. It has to do some basic reading and writing to and from files on the hard disk, and also to a floppy. I have foreseen a potential...
3
by: WindAndWaves | last post by:
I am writing error handling procedures at the moment. Here are some questions: 1. Can you write a procedure that picks up any error and deals with it no matter where it happens in the database?...
21
by: Rob Somers | last post by:
Hey people, I read a good thread on here regarding the reason why we use function prototypes, and it answered most of my questions, but I wanted to double check on a couple of things, as I am...
0
by: Andy S. | last post by:
I'm not very knowledgeable using Visual Studio deployment projects, but I have 2 questions. 1. Can you perform SQL server database functions (i.e. Add views, stored procedures)? I overcame...
6
by: Venkatesh | last post by:
Hello All, I have couple of doubts regarding the concept of on-demand javascript loading using javascript code. I could see on the net different techniques for achieving this - techniques like:...
23
by: TefJlives | last post by:
Hi all, I'm learning a bit about C, and I have a few questions. I'm not trying to insult C or anything with these questions, they're just honestly things I don't get. It seems like pointers...
4
by: Viviana Vc | last post by:
Hi all, I've read the WindowsVistaUACDevReqs.doc documentation and I have done different small tests on Vista to understand the bahaviour and now I have a few questions. 1) If I create a...
30
by: GeorgeRXZ | last post by:
Hi Friends, I have some questions related to C Language. 1What is the difference between the standard C language and Non standard C language ? 2which is better C Lanugage, C under Linux/...
22
by: Jesse Burns | last post by:
I'm about to start working on my first large scale site (in my opinion) that will hopefully have 1000+ users a day. ok, this isn't on the google/facebook scale, but it's going to be have more hits...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
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: 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
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.