I am using the BinaryReader class in System.IO namespace (in C# of course) for reading data from a file. It's very fast (can read 1,000,000 bytes in less than a second) but I'm using a DataGridView control to show them in my form and (as you may know) it is very absurd! it is highly slow and can change that "less than a second" to about twenty seconds!!! I'm searching for fastest way to show these data in my form. Thanks a lot for your helping.
My code's like this:
Code:
using System.IO;
void Fill_DataGridView1_using_BinaryReader(string path)
{
BinaryReader br = new BinaryReader(path);
for (int i = 0; i < length(path); i++)
DataGridView1.Rows.Add(br.ReadChars(10 /* for example */));
}
Code:
using System.IO;
void Fill_DataGridView1_using_BinaryReader_#2(string path)
{
BinaryReader br = new BinaryReader(path);
List<string> data = new List<string>();
for (int i = 0; i <= length(path); i++)
data.Add(br.ReadChar());
// 0.4 seconds passed
for (int i = 0; i < data.Length; i++)
DataGridView1.Rows.Add(data[i]);
// 20.4 seconds passed!!!
}
