B
Bob Hollness
Hi all.
I have a Sub that calls another sub. Both subs use a common object, so I
used Public to declare it at the top of the module, as below.
Public Writer As StreamWriter = File.CreateText(Application.StartupPath &
"\Update.txt")
The first time my Sub runs it works fine. But the second time it fails
telling me "Cannot write to a closed TextWriter. I am guessing that this is
because the Public section is only read once instance of the application. I
have to close the TextWriter so that I can use the file in another process.
Any idea how I can either ensure that the Public section is re-read, or,
provide the TextWriter to the 2nd Sub?
I have a Sub that calls another sub. Both subs use a common object, so I
used Public to declare it at the top of the module, as below.
Public Writer As StreamWriter = File.CreateText(Application.StartupPath &
"\Update.txt")
The first time my Sub runs it works fine. But the second time it fails
telling me "Cannot write to a closed TextWriter. I am guessing that this is
because the Public section is only read once instance of the application. I
have to close the TextWriter so that I can use the file in another process.
Any idea how I can either ensure that the Public section is re-read, or,
provide the TextWriter to the 2nd Sub?