The code reads data from an excel.csv file
If a row cell contains data with a line return ie Alt+Enter
The result is the code reads it’s as a new Line, and therefore errors.
Dim objSR As New IO.StreamReader(objOFD.FileName)
dgImportedData.Rows.Clear()
Do While Not objSR.EndOfStream
Dim strLine() As String = objSR.ReadLine.Replace("""", "").Replace("#", "").Split(",")
If Not strLine(0).Trim = "" Then
Ive added a replace to include a line return character r’vbCrLf’, however the results are it ignores, and still errors
Dim strLine() As String = objSR.ReadLine.Replace("""", "").Replace("#", "").Replace(vbCrLf, "").Split(",")
Any ideas how I can check if the data contains a line return, and remove and replace the line return in excel.
TIA
If a row cell contains data with a line return ie Alt+Enter
The result is the code reads it’s as a new Line, and therefore errors.
Dim objSR As New IO.StreamReader(objOFD.FileName)
dgImportedData.Rows.Clear()
Do While Not objSR.EndOfStream
Dim strLine() As String = objSR.ReadLine.Replace("""", "").Replace("#", "").Split(",")
If Not strLine(0).Trim = "" Then
Ive added a replace to include a line return character r’vbCrLf’, however the results are it ignores, and still errors
Dim strLine() As String = objSR.ReadLine.Replace("""", "").Replace("#", "").Replace(vbCrLf, "").Split(",")
Any ideas how I can check if the data contains a line return, and remove and replace the line return in excel.
TIA