vb.net - Saving and updating a .txt file in VB -


i wrote code create summary.txt file , write lines it.

this code:

dim filetosaveas string = savefiledialog1.filename dim file new system.io.streamwriter(filetosaveas)  file.writeline("date , time" & " " & datetime.now.tostring("yyyy/mm/dd hh:mm:ss")) file.writeline(" ") file.writeline("client number: " & " " & clients) file.writeline("") file.writeline("beginning of new order:") file.writeline("")  index = 0 orderlistbox.items.count - 1     file.writeline(orderlistbox.items(index)) next  file.writeline("") file.writeline("price" & " " & "£" & " " & zyzz) file.writeline("") file.writeline("vat" & " " & "£" & " " & vat) file.writeline("") file.writeline("total" & " " & "£" & " " & max) file.writeline("") file.writeline("") file.writeline("") file.writeline("______________________________________________________") file.writeline("") file.writeline("") file.close()  clients = clients + 1 

this code create , pop new save file dialog user decides save how want it. whenever user target code again trigger save file dialog again absolutely don't want do.

what want add new lines same .txt file saved

any help?

dim file new system.io.streamwriter(filetosaveas, true) 

the true means new data append file, false overwrite file. if specified file not exist, parameter has no effect, , constructor creates new file.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -