When running debugger, i am getting the following error,
A first chance exception of type 'System.IndexOutOfRangeException' occurred in HSL File Config.exe Additional information: Index was outside the bounds of the array. An unhandled exception of type 'System.IndexOutOfRangeException' occurred in HSL File Config.exe Additional information: Index was outside the bounds of the array. The program '[14044] HSL File Config.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
i have checked the csv data file im loading is in fact 30 columns long and no blank lines. there are however some blank fields.
Dim FileName = tbOpen.Text
Dim fileout = tbSave.Text
Dim lines = File.ReadAllLines(FileName)
Dim output As New List(Of String)
For Each line In lines
Dim fields = line.Split(","c)
If fields(0) = "R62167" Then
ReDim Preserve fields(fields.Length)
fields(31) = "9991"
End If
If fields(0) = "R62193" Then
ReDim Preserve fields(fields.Length)
fields(32) = "1999"
End If
If fields(2) = "2249" Then
fields(2) = "0000"
End If
output.Add(String.Join(","c, fields))
Next
File.WriteAllLines(fileout, output)