Hi,
I used this one, seems to worked good for me
Change string delimiter to youe suit, I used comma
separated text file
~'J'~
Public Function ConvToArray(ByVal myList As ArrayList, ByVal bound As Integer) As String(,)
Dim tmp As Array, n As Integer
tmp = myList.ToArray
Dim out(0 To (myList.Count / bound) - 1, bound - 1) As String
For i As Integer = 0 To (myList.Count / bound) - 1
For j As Integer = 0 To bound - 1
out(i, j) = tmp(n)
n += 1
Next
Next
Return out
End Function
Public Function ReadFromFile(ByVal fn As String) As String(,)
Dim fs As FileStream
Dim txf As StreamReader
Dim rdata As New ArrayList()
Dim tmp As String() = Nothing
Dim out As String(,)
Dim s As String
Dim itm As New ArrayList()
rdata.Clear()
itm.Clear()
Dim ln As [Object]
Try
fs = New FileStream(fn, FileMode.Open, FileAccess.Read)
txf = New StreamReader(fs)
s = txf.ReadLine
Do Until s Is Nothing
tmp = Split(s, ",")
For i As Integer = 0 To UBound(tmp)
ln = tmp(i)
itm.Add(ln)
Next
rdata.AddRange(tmp)
s = txf.ReadLine
Loop
fs.Close()
out = ConvToArray(rdata, UBound(tmp) + 1)
Catch ex As Autodesk.AutoCAD.Runtime.Exception
Throw New Autodesk.AutoCAD.Runtime.Exception("If the file existed it was closed")
Finally
End Try
Return out
End Function