VB.NET – DataGridView retains Waitcursor when updating from thread

I have a DataGridView control in my Windows Forms application.
I am using a background thread to add rows to the grid. I change the cursor of the form to Waitcursor when the process starts , And return to Default at the end. This applies to forms, but not to grids. When the cursor of the form changes back to the default value, the cursor of the grid does not change, even though the cursor is on the rest of the form .

Does this have anything to do with the fact that I update the grid from a background thread? (The cursor is changing directly from the UI thread).

Edit: The background process raises an event, and the handler checks the InvokeRequired property of the grid and decides whether to “call” the method again from the main thread. Actually , The actual UI update happens from the appropriate thread. I’m not sure if this means I’m “using a background thread”. 😐

I encountered some problems when using datagrids for single-threaded update. After I set waitcursor to true, datagrid did not reset to normal cursor.
I did it after I went

this.UseWaitCursor = false;

I added

DatagridviewFoo .Cursor = this.Cursor;

Maybe this is the same problem for you

I have a DataGridView in my Windows Forms application Control.
I am using a background thread to add rows to the grid. I change the cursor of the form to Waitcursor when the process starts, and return to Default at the end. This works for the form, but not for the grid. When the window When the cursor of the body changes back to the default value, the cursor of the grid does not change, even though the cursor is on the rest of the form.

This is the same as when I update the grid from a background thread. Does the fact matter? (The cursor is changing directly from the UI thread).

Edit: The background process raises an event, and the handler checks the InvokeRequired property of the grid and decides whether to “call” the method again from the main thread. Actually , The actual UI update happens from the appropriate thread. I’m not sure if this means I’m “using a background thread”. 😐

I encountered some problems when using datagrids for single-threaded updates. After I set waitcursor to true, the datagrid did not reset to a normal cursor.
What did I do after I went

this.UseWaitCursor = false;

I added

DatagridviewFoo.Cursor = this.Cursor;

< p>Maybe this is the same problem for you

Leave a Comment

Your email address will not be published.