Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27353

Write Cobobox's To Text File

$
0
0
Not sure if this is the right place to post this but , im trying to get the combo box's on my program to save to a text file but the code i have at the moment is saving to a textfile but when i input new information in the combo box's its replacing the last text i saved instead of adding to the previous saved text , how can i change the following code to create another textfile in the same folder or add the new information into the same text file;

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim FILE_NAME As String = "F:\Monster Computers\Order1.txt"

If System.IO.File.Exists(FILE_NAME) = True Then

Dim objWriter As New System.IO.StreamWriter(FILE_NAME)

objWriter.WriteLine(ComboBox1.Text)
objWriter.WriteLine(ComboBox2.Text)
objWriter.WriteLine(ComboBox3.Text)
objWriter.WriteLine(ComboBox4.Text)
objWriter.WriteLine(ComboBox5.Text)
objWriter.WriteLine(ComboBox6.Text)
objWriter.WriteLine(ComboBox7.Text)
objWriter.WriteLine(ComboBox8.Text)
objWriter.WriteLine(ComboBox9.Text)
objWriter.WriteLine(ComboBox10.Text)
objWriter.WriteLine(ComboBox11.Text)
objWriter.WriteLine(ComboBox12.Text)

objWriter.Close()
MsgBox("Order Saved")

Else

MsgBox("Order Failed")

End If
End Sub
End Class

Viewing all articles
Browse latest Browse all 27353

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>