We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridControl BeginUpdate/EndUpdate

Thread ID:

Created:

Updated:

Platform:

Replies:

10403 Jan 31,2004 05:17 PM UTC Jan 31,2004 11:55 PM UTC WinForms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 31, 2004 05:17 PM UTC

Hello, I have a substantial amount of modifications to make to individual cells within my GridControl object. If I do not make a call to BeginUpdate, the rendering of the grid is very slow. However, if I do call BeginUpdate on the grid, if I have a messagebox or other type of alert that needs to be displayed to the user before the EndUpdate method is called, my app will hang indefinitely with the CPU usage at 100% and the MessageBox will not be shown. If I ensure that I call EndUpdate before displaying my MessageBox, then I don''t have any problems. While this might be acceptable for most of the operations in the grid, if something causes an unexpected error and a alert is shown and I have suspended any updates to the grid, the app will hang and must be restarted altogether. In addition, it would be a real pain to manually call BeginUpdate and EndUpdate at every possible chance where something might need to be displayed. Suggestions?

Administrator [Syncfusion]
Replied On January 31, 2004 10:39 PM UTC

Even if the MessageBox displays OK as the result of some exception, I think you will have to handle that exception to somehow reset the grid so it starts painting again. The BeginUpdate/EndUpdate code ignores WM_PAINT messages to avoid the painting. This is what sets up the endless loop when you try to display a MessageBox while an update is in progress. So, one solution is to include a try-catch in your update code, and in the catch block, cancel or end the update before either rethrowing the exception, or displaying something yourself. Another solution is to use interop to freeze the painting (and not ignore the WM_PAINTs in WndProc). This technique is discussed in one of our WindForms FAQ. http://www.syncfusion.com/faq/winforms/search/637.asp Here is a sample that illustrates both techniques.

Administrator [Syncfusion]
Replied On January 31, 2004 11:50 PM UTC

The second option (freezing the painting) seems to be the easiest to implement but, when I try it, I can''t seem to get the scrollbars of the GridControl to display properly without resizing the window that contains the grid.

Administrator [Syncfusion]
Replied On January 31, 2004 11:50 PM UTC

The second option (freezing the painting) seems to be the easiest to implement but, when I try it, I can''t seem to get the scrollbars of the GridControl to display properly without resizing the window that contains the grid.

Administrator [Syncfusion]
Replied On January 31, 2004 11:55 PM UTC

Nevermind, I included the freeze property into my derived GridControl and was invalidating the grid itself, not the form that contained it. Everything works now, thanks again!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;