Click here to Skip to main content
11,714,345 members (81,594 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
Hi all, I've built a method to perform various operations on a DataGridView (disable columns, rename header columns, format cells ecc. ecc.).

The first time I use method with one DataGridView it works very quickly.

If I use the same method another time with the same DataGridView (for example to refresh it after some operations) it works much more slowly.

It takes very long time to perform operations I report below:

dgvCol.DefaultCellStyle.Format = string.Format(veroFormatoNumerico, System.Globalization.CultureInfo.InvariantCulture);
dgvCol.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
dgvCol.HeaderText = sVisualizza;

Why the first time I use them it takes short time and the second time it takes much more time? What should I do?

Posted 28-Jan-13 23:54pm
supernorb at 30-Jan-13 18:06pm
I think it is still not clear about what you are trying to do and the detail of your code. I think many answerers in codeproject want to vote you down for questions like this, but I'm an exception. Don't want to vote down anything, anyone... =)) However if there are dozens of down vote, I will feel happy to add more one of myself to that thing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 420
1 Maciej Los 229
2 Richard MacCutchan 220
3 OriginalGriff 170
4 F-ES Sitecore 140
0 Sergey Alexandrovich Kryukov 545
1 CHill60 375
2 Maciej Los 324
3 Richard MacCutchan 310
4 OriginalGriff 260

Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100