briprogram
MIS
Hi
I have information from textboxes that are being placed into a textfile from a streamwriter but I want it to write to the end of the file, like add on to what is already there. How can I do that?
--------------------------
Thanks
Brian
I have information from textboxes that are being placed into a textfile from a streamwriter but I want it to write to the end of the file, like add on to what is already there. How can I do that?
Code:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim filewriter As StreamWriter
Dim output As FileStream
Dim filechooser As New SaveFileDialog
Dim result As DialogResult = filechooser.ShowDialog
Dim filename As String
If result = Windows.Forms.DialogResult.Cancel Then
Return
End If
filename = filechooser.FileName
output = New FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write)
filewriter = New StreamWriter(output)
'btnReadFile.Enabled = True
filewriter.WriteLine(txtFirst.Text & vbTab & txtLast.Text & vbTab & _
txtID.Text & vbTab & txtGrade.Text & vbTab & txtClass.Text)
filewriter.Close()
txtFirst.Text = ""
txtLast.Text = ""
txtID.Text = ""
txtGrade.Text = ""
txtClass.Text = ""
End Sub
--------------------------
Thanks
Brian