Hi!
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!:irritated: it is highly slow and can change that "less than a second" to about twenty seconds!!!:loading: I'm searching for fastest way to show these informations in my form. Thanks a lot for your helping.
My code's like this:
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 */));
}
"Read from file" problem
Started by pb_ce85, Jul 11 2008 02:17 PM
3 replies to this topic
#1
Posted 11 July 2008 - 02:17 PM
|
|
|
#3
Posted 12 July 2008 - 08:01 PM
Thanks Xav.
I examined the code below but unfortunately didn't work. Loading data is not my problem, Showing them in a DataGridView control reduces my speed.
I examined the code below but unfortunately didn't work. Loading data is not my problem, Showing them in a DataGridView control reduces my speed.
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!!!
}


Sign In
Create Account


Back to top









