943,754 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 818
  • VB.NET RSS
Mar 31st, 2009
0

StreamWriter Is Overriding Already Written Items in File

Expand Post »
Hello everyone. I have a small problem. I have a Streamwriter writing things to a file. But when i write more than one thing, the previous item gets overwritten. I.E. Write 1111, Write 2222. 1111 gets replaced by 2222.

Here is some of my code:

VB.NET Syntax (Toggle Plain Text)
  1. Dim fileOut As New IO.StreamWriter(fileName)
  2.  
  3. fileOut.WriteLine(userId)
  4.  
  5. fileOut.Close()

userId is a String
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
jhonnyboy is offline Offline
97 posts
since Jul 2008
Mar 31st, 2009
0

Re: StreamWriter Is Overriding Already Written Items in File

You have to create StreamWriter in the append mode
VB.NET Syntax (Toggle Plain Text)
  1. Dim fileOut As New System.IO.StreamWriter(fileName, True)
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Mar 31st, 2009
0

Re: StreamWriter Is Overriding Already Written Items in File

It's not appending yet. I added to true to the end, but that didn't do anything. It's still overwriting
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
jhonnyboy is offline Offline
97 posts
since Jul 2008
Mar 31st, 2009
0

Re: StreamWriter Is Overriding Already Written Items in File

Ah Nevermind. Thank you so much!

How can i make a multi column listbox? I added the true under properties for multi column, and added the width, but don't see anything. I wanted to make a column for user Names and another for User Ids.
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
jhonnyboy is offline Offline
97 posts
since Jul 2008
Mar 31st, 2009
0

Re: StreamWriter Is Overriding Already Written Items in File

Click to Expand / Collapse  Quote originally posted by jhonnyboy ...
Ah Nevermind. Thank you so much!

How can i make a multi column listbox? I added the true under properties for multi column, and added the width, but don't see anything. I wanted to make a column for user Names and another for User Ids.
It appends now? Great. Please mark the thread solved and re-post that new question in a new thread, thanks.
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Mar 31st, 2009
0

Re: StreamWriter Is Overriding Already Written Items in File

You got it
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
jhonnyboy is offline Offline
97 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Howto: Pan and Zoom an image in the picture box in vb.net?
Next Thread in VB.NET Forum Timeline: Multi Column List Boxes





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC