简体   繁体   中英

Slow Response Time when sending event data to another form

I have a C# winform application that has 4 distinct user controls on the screen. Each of these user controls contains a datagridview control. When the user updates a cell value in any one of these 4 control I raise a custom event sending the value of the cell to a 5th form on the screen.

This 5th form is very similar to an Excel spreadsheet. The 5th form must show the new value sent on it's pane/window. The issue is not in sending the data from any of the 4 user controls, that works and is reflected on the 5th form.

However, when the event to send data is raised it stops the user input for a few seconds. I think the 5th form is busy updating the cells. So my question is if I implement a message queue or something similar (wcf) for sending the new values to the spreadsheet like control, will that 5th control pickup the data (maybe on Application Idle event) and not slow down the end user input on any of the 4 main controls or will I just see the same issue because of the forms all running in the same UI thread. I did do a some testing to see if it's any quicker if the 5th control is hidden from view, but I see the same results. Also I did some timing checks and it is definitely after I raise the Value_Changed event that the system is becomes very slow.

Any ideas on how to approach and solve this issue?

Perhaps you should try a simple Control.BeginInvoke() to pass the data with a structure. This will ensure you don't have threading issues between objects AND is asynchronous.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM