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:

Dim fileOut As New IO.StreamWriter(fileName)

        fileOut.WriteLine(userId)

        fileOut.Close()

userId is a String

Recommended Answers

All 5 Replies

You have to create StreamWriter in the append mode

Dim fileOut As New System.IO.StreamWriter(fileName, True)

It's not appending yet. I added to true to the end, but that didn't do anything. It's still overwriting :(

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.

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.

You got it :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.