Hi there,
I have a binary file which consists of header information followed by
the 'dataset', made up of 8 byte doubles.
I'm trying to find the best way to display this data in a datagrid. My
current method uses binaryreader.ReadDouble to read each value from the
file and construct a DataTable which can then be binded to the
datagrid. However, it's very slow...
Dim fs As FileStream = New FileStream(psFileName, FileMode.Open)
Dim br As BinaryReader = New BinaryReader(fs)
Dim i, j, iDataStartPos, iNumRows, iNumCols as int32
Dim dWorkRow As DataRow
Dim oDataTable As dataTable
' These can be determined from the header:
iDataStartPos = 150
iNumRows = 3000
iNumCols = 1000
br.BaseStream.Seek(iDataStartPos, SeekOrigin.Begin)
pdtDataTable = New DataTable("DATFILE")
For i = 0 To iNumRows - 1
dWorkRow = pdtDataTable.NewRow
For j = 0 To piNumCols - 1
dWorkRow(j)= br.ReadDouble()
Next
oDataTable.Rows.Add(dWorkRow)
Next
Can anyone suggest a better method?
Thanks in advance.