473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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

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?

Oct 11 '07 #1
2 11494
Have you tried dataGridView1.SuspendLayout () ?

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

Boaz Ben-Porat
Milestone systems A/S
Denmark

"hjin" <hj**@provisionnetworks.comskrev i en meddelelse
news:11**********************@19g2000hsx.googlegro ups.com...
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?

Oct 11 '07 #2
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.
Oct 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Steve | last post by:
Hi, How can I send a python script a suspend signal? I need to suspend a script that frequently updates the database so that I can do a "vacuum" on the database without affecting the script....
2
by: Stephan Steiner | last post by:
Hi I'm using several DataTables in my program which are updated periodically. At the same I have those tables bound to DataGrids in my GUI. So far I've been doing all the processing in the same...
3
by: Rich | last post by:
Hello, If I want to update data displayed in a datagrideview/datagridview cell, how can I determine what cell I am updating? I am looking at the click event below, for example. Can I get...
2
by: bob | last post by:
Can anyone tell me the best way to update a dataset while it is being edited/viewed in the DataGridView control? Is this something that should be inserted into one of the grid's events? or should...
2
by: Alan T | last post by:
As the Suspend method is deprecated, what method can I use? What I want to do is when the user press the button "Cancel", it will prompt the user to confirm it he want to stop the process, I need...
7
by: John J. Hughes II | last post by:
I have a DataGridView with a TextBoxColumn. I setting the data source to a List<stringvalue in a static class. The list is filled from a background thread. So far all is fine and it works...
1
by: weird0 | last post by:
How can i update the data in my database directly through datagridview....? Can anyone tell me the appropriate links and what is the exact event in datagridview that handles it and some explanation...
0
by: hjin | last post by:
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...
7
by: Bill Schanks | last post by:
VB.NET 2005 SQL Server 2000 I have a datagridview that users will update. When there are only a few records the update is fine. However when they update 100-200 of the rows the udpate can take...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

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.