vb.net - CSV in visual Basic -
i trying seperate text box list have using csv. saving excel , titles have go individual cell, text boxes go one. want them in seperate cell also.
also, how can add new information without overwriting previous info saved?
thanks
dim csvfile string = my.application.info.directorypath & "\hosedata.csv" dim outfile io.streamwriter = my.computer.filesystem.opentextfilewriter(csvfile, false) outfile.writeline("job number, sales order number, date") outfile.writeline(textbox1.tex & textbox2.text & datetimepicker1.text) outfile.close() console.writeline(my.computer.filesystem.readalltext(csvfile))
you need add commas in output:
outfile.writeline(textbox1.text & "," & textbox2.text & "," & datetimepicker1.text)
per additional requirement of quotes around datetimepicker data fleshed out in comments below:
outfile.writeline(textbox1.text & "," & textbox2.text & "," & """" & datetimepicker1.text & """")
to append instead of overwrite, plutonix mentioned above, use
opentextfilewriter(csvfile, true)
Comments
Post a Comment