I am working with VB.NET and have the below code which writes to a CSV file.
My problem arises when the user uses a “,” as their value for the textboxes on my windows form.
So instead of writing the below values to the CSV:
It’s writing like the below instead:
I understand why this problem is happening and it’s because the “,” is being used to split the column. My problem however is I don’t know enough to find a fix for it as I am still very new to programming.
Is someone able to provide me with a fix for my scenario? My code is below.
Private Sub btnUPrint_Click(sender As Object, e As EventArgs) Handles btnUPrint.Click
Dim HistCSV As String
HistCSV = My.Computer.Registry.GetValue(gRegKeyName, "HistoryFileLocation", "")
Dim out As System.IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter(HistCSV, True)
out.WriteLine(txtUChkNum.Text & "," & DateTimePicker1.Text & "," & txtUAmt.Text & "," & txtUPayTo.Text & "," & txtURef.Text)