writing to MemoryStream

PeteN

Member
Joined
Feb 25, 2008
Messages
6
Programming Experience
Beginner
I'm currently writing data to a memory stream using the following

VB.NET:
Dim _ms As New MemoryStream
Dim _tw As TextWriter = New StreamWriter(_ms)
_tw.WriteLine("Line 1")
_tw.Flush()
_tw.WriteLine("Line 2")
_tw.Flush()
_tw.WriteLine("Line 3")
_tw.Flush()
_tw.Close

The issue I have is that after Line 3 there is a blank line . I think I need to chance line 3 from _tw.WriteLine to something that does not put a line terminator on it
 
I think I need to chance line 3 from _tw.WriteLine to something that does not put a line terminator on it

You are quite correct. If you actually read the documentation for the StreamWriter class or even just pay attention to Intellisense as you type the code, you'll see exactly what that alternative is. You could probably even make a pretty good guess if you simply think about the name 'WriteLine'.
 
Back
Top