Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

How to suspend DataGridView while I am updating a lot of data?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hjin - 11 Oct 2007 19:37 GMT
DataGridView takes very much time if I update a lot of data

I have a DataGridView which has a DataSource (a DataTable) of 3000
rows. If I want to update one column of every rows in the DataTable,
my whole appliation freezes with any response. After a lot of time, it
comes back.

If I set the DataSource to null before changing the data and set it
back after changing. There' s no problem. But I lost the status of the
DataGridView, like current selected row, sorting, etc.

Is there any way to prevent the DataGridView to do anything while I am
updating the data in the DataTable?
Boaz Ben-Porat - 11 Oct 2007 21:54 GMT
Have you tried dataGridView1.SuspendLayout () ?

I haven't tried it myself, but i think it works.

Boaz Ben-Porat
Milestone systems A/S
Denmark

> DataGridView takes very much time if I update a lot of data
>
[quoted text clipped - 9 lines]
> Is there any way to prevent the DataGridView to do anything while I am
> updating the data in the DataTable?
hjin - 12 Oct 2007 14:21 GMT
I tried SuspendLayout and SuspendBinding. All didn't work.

Finally I found because I set all columns' AutoSize to AllCells,
everytime I changes a value in one cell, it goes through all the cells
in the column to recaculate the column's width. I think it's a bad
code because it already knows the preivous width and it should only
caculate the width of the changed cell. I have to set the columns'
AutoSize to None before changing the data and set them back to
AllCells afterwards.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.