Datagridview not updating

Rated 3.98/5 based on 595 customer reviews

Invoke method to marshal the manipulating to the GUI control from another thread. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights Hi Jeffrey, Thanks, your suggestion works.

Below is my modified sample code snippet: Data Table dt; private void Form1_Load(object sender, Event Args e) void fsw_Created(object sender, File System Event Args e) private void button1_Click(object sender, Event Args e) This code snippet works well on my side. I no longer needs to manually refresh or Reset Bindings the Data Grid View.

Visit Stack Exchange are properly shown on the grid.

By the way, did you have any chance to work on the efficiency problem on huge datatable, see the thread.

We also need this to be fixed since we need to release it in 2 months.

Net Winform databinding code will try to update the new row into the Data Grid View UI. Net Windows Forms uses the single-threaded apartment (STA) model because Windows Forms is based on native Win32 windows that are inherently apartment-threaded. Thanks, -- George ""Jeffrey Tan[MSFT]"" wrote: Sorry, forgot to attach the sample project. Best regards, Jeffrey Tan Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. Yes, any operations may cause calling to the GUI thread methods/properties need to be mashaled. Yes, I see your concern, many customers have feedbacked such request regarding . However, this marshaling request is not caused by . Best regards, Jeffrey Tan Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.

The STA model implies that a window can be created on any thread, but it cannot switch threads once created, and all function calls to it must occur on its creation thread. Comment: Wrapping these calls become very cumbersome, and potentially a bottle neck since UI thread may be bogged down by work. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights Hi George, Thanks for your feedback! Yes, read-only manipulation to the GUI thread also needs to be wrapped with Control. Let's suppose a control is still updating its state while you are retrieving its state, you may get an immediate partial updated state which may appear to be incorrect. To wrap these methods or properties calling, you may write a method(let's call it Wrap Method() ) in Form class which contains all these code, then in File System Watcher thread, you can just marshal once calling to the Wrap Method(), not marshal to all the code statements. Net Winform code, it is caused by the native Win32 standard controls. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. If you have any concern, please feel free to tell me, thanks!

Leave a Reply