I have created a CSV File using the following function:
When I view the file using NOTEPAD the file looks fine, but when I open it in Excel, the first line start with the following characters 
Does anybody know why this happens? Is it the version of Excel that I am using? (MS Excel 2002)
Thanks Keyth.
Code:
Private Function outputtocsv(ByVal tbl As DataTable) As String
Dim returnString As String = AppPath() & "Exports\EndOfDay.csv"
Dim outputtext As String = ""
If File.Exists(returnString) Then
File.Delete(returnString)
End If
Try
Dim row As DataRowView
Dim dv As DataView
dv = tbl.DefaultView
Dim headers As String = ""
Dim clm As DataColumn
For Each clm In dv.Table.Columns
headers += clm.ColumnName & ", "
Next
Dim clmcount As Integer = tbl.Columns.Count
headers = headers.Trim
headers = Mid(headers, 1, headers.Length - 1)
headers += ControlChars.CrLf
Dim rowString As String = ""
For Each row In dv
rowString = ""
For I As Integer = 0 To clmcount - 1
If row(I).ToString.Contains(CStr(ControlChars.Quote)) Then
Dim tempstr As String = row(I).ToString.Replace(CStr(ControlChars.Quote), CStr(ControlChars.Quote) & CStr(ControlChars.Quote))
tempstr = ControlChars.Quote & tempstr & ControlChars.Quote & ","
rowString += tempstr
ElseIf row(I).ToString.Contains(",") Then
rowString += ControlChars.Quote & row(I).ToString & ControlChars.Quote & ","
Else
rowString += row(I).ToString & ","
End If
Next
rowString = rowString.Trim
rowString = Mid(rowString, 1, rowString.Length - 1)
outputtext += rowString + ControlChars.CrLf
Next
My.Computer.FileSystem.WriteAllText(returnString, headers & outputtext, False)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Return returnString
End Function
When I view the file using NOTEPAD the file looks fine, but when I open it in Excel, the first line start with the following characters 
Does anybody know why this happens? Is it the version of Excel that I am using? (MS Excel 2002)
Thanks Keyth.