Can I have two files open at the same time to write text into, in VB .net?
I have this code:
Then I use this to write lines of text to each file:
If I open a file, write to it, then close it, everything works fine. But if I try to have both open at the same time all the text ends up in the first file and nothing gets written to the second! There are no build errors.
What am I doing wrong?
Thx.
I have this code:
VB.NET:
Dim fsStream As New FileStream(EVENT_LOG_PATH & EVENT_LOG_FILENAME & DateString & ".ip", FileMode.Append, FileAccess.Write, FileShare.Read)
Dim swWriter As New StreamWriter(fsStream)
' Open log file for use by VLOG
Dim fsVLOGStream As New FileStream(EVENT_LOG_PATH & VOLTS_LOG_FILENAME & DateString & ".ip", FileMode.Append, FileAccess.Write, FileShare.Read)
Dim swVLOGWriter As New StreamWriter(fsStream)
Then I use this to write lines of text to each file:
VB.NET:
swWriter.WriteLine(str)
swVLOGWriter.WriteLine(str)
If I open a file, write to it, then close it, everything works fine. But if I try to have both open at the same time all the text ends up in the first file and nothing gets written to the second! There are no build errors.
What am I doing wrong?
Thx.