471,627 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

DataGridView Performance issue

FX
Hi all,
I'm using a CLR 2 component DataGridView and I'm encountered Performance
issue.
Here is the snippet :
string valueStr = value.ToString();
DataGridViewRowCollection rows = dataGridView1.Rows;
foreach (DataGridViewRow dataGridViewRow in rows) {
dataGridViewRow.Cells[0].Value = valueStr;
}

The type of first column is DataGridViewCheckBoxCell.
I takes more than 15 sec to execute this part of code (my component only
have 200 rows).

Does anyone has an idea to improve this ?

Thanks in advance
Fx
Jan 18 '06 #1
1 1896
First - have you tested the performance outside of the debugger? (pref. in
release mode) Things can often be deceptive.

Second - it's not clear what your data is; if this is a custom class you
could look into the performance of the property setter? Or even (if a
bespoke class that provides property notifications) update the objects'
properties directly (perhaps suspending either UI updates or binding while
you do it).

Third - I'm not sure if it will help (I might misunderstand these
functions), but you could try preventing UI updates?

datagridview1.SuspendLayout(); // disable layout
try {
// your code
}
finally {
datagridview1.ResumeLayout(true); // enable and process pending
}

Fourth - weep

Marc
Jan 18 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by WayDownUnder | last post: by
2 posts views Thread by Rick Shaw | last post: by
2 posts views Thread by M R | last post: by
7 posts views Thread by Bill Schanks | last post: by
6 posts views Thread by Miro | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.