-
Notifications
You must be signed in to change notification settings - Fork 945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unresponsiveness issue during Real-Time Updates in Winforms DataGridView #11335
Comments
@KlausLoeffelmann could you take an initial look at this? |
This issue can be reproduced using the following simple code
|
I don't think this is a bug. You are using thread.sleep in the UI thread. It would be better to use a separate thread (via a background worker or similar) to report progress to the UI thread. |
We have checked the background worker with our scenario, but it did not help and caused an exception. When we call DataGrid.Refresh for a specific record by passing in the BackgroundWorker.ReportProgress, it also throws an exception. If we call BackgroundWorker.ReportProgress for a certain limit of records, the value only updates for those records. Please find the sample demo in the attachment. Could you please take a look at that sample and suggest a proper way to achieve this? |
@DhivyaBharathi-SF3890 I would avoid using datagrid and instead use a progress bar. Using the background worker report progress to change the progress percentage and some sort of text indicating the number of completed vs total (100/1000). Your dowork event needs to take in parameters, do work (reporting as you go), then return a result. You can't access things on the UI thread in doWork, This is why you pass parameters to it. |
.NET version
.Net 7.0
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No response
Issue description
In DataGridView, while updating the values like real-time updates, the demo becomes unresponsive. Without using the Refresh() method the values are not updated.
DataGrid_Refresh.zip
Steps to reproduce
1.Run the sample.
2.Click the Refresh button.
Observed Behavior:
The sample enters into the Not responding state
The text was updated successfully, but these errors were encountered: