Maybe a Filewriter.Flush() between each WriteLine()? Also, you might not need the Seek(), try taking that out and see if it works.
mikiurban
Junior Poster in Training
65 posts since Oct 2009
Reputation Points: 27
Solved Threads: 17
There is no overload of StreamWriter(stream, append) because the "append" property is specified when you create the stream.
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim fs As New FileStream("scores.txt", FileMode.Create, FileAccess.Write)
Dim s As New System.IO.StreamWriter(fs) 'This gets the file create/append properties from the New Filestream() line
Try
Dim Filewriter As StreamWriter = New StreamWriter("Scores.txt", True)
Filewriter.WriteLine("abc" & " " & "123")
Filewriter.Close()
Catch ex As Exception
MsgBox("Cannot Save")
End Try
End Sub
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
Is the code above correct? I see 2 StreamWriters created, and only one being used.
mikiurban
Junior Poster in Training
65 posts since Oct 2009
Reputation Points: 27
Solved Threads: 17
Since you're only writing a small amount of data I would call the static System.IO.File.WriteAllText() and not worry about streams.
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735