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. Image for the cookie policy date

ProgressBarCells sample application keeps crashing

I am currently evaluating the essential grid and am going through the sample applications included with the eval. I want to be able to update the grid very frequently and have good performance. The ProgressBarCells sample seems to demonstrate this once checking the animate check box however when I make use of the splitter functionality located on the corners and resize the splitters it crashes frequently (Throws an exception). Is the grid very unstable when updated frequently?

7 Replies

AD Administrator Syncfusion Team December 1, 2003 11:38 PM UTC

That sample fires a timer every 10 msecs. When you split things in 4 panes, you have 4 such timers firing every 10 msecs on the same UI thread. This is bogging things down. Here is a sample that uses multiple threads to avoid bogging down the UI thread. http://www.syncfusion.com/support/user/Uploads/multithread_1079.zip

RY Ryan December 5, 2003 05:47 PM UTC

Even though it gets booged down should it be throwing unhandled exceptions? What exactly is causing it to throw exceptions? If it is getting bogged down then shouldnt it just go slower?

AD Administrator Syncfusion Team December 5, 2003 06:39 PM UTC

The problem is that the timer tick is fired before the previous timer tick is completed. This means that the Application.DoEvents(); at the bottom of the timer tick event is really never hit, and window messages are just being queued and not processed, with the Timer Tick events just getting queued up. So, if you move the Application.DoEvents(); from the bottom to the top of the timer tick event, things work more smoothly, but still bog down.

AD Administrator Syncfusion Team December 5, 2003 08:02 PM UTC

The correct implementation would actually be to have only one timer fired that updates the grids progress bar values through the model. It''s just that in the ProgressBarSample sample we didn''t consider the case that all four panes are open and then 4 timers compete with each other. Stefan

AD Administrator Syncfusion Team December 6, 2003 07:00 AM UTC

Setting a flag to avoid multiple calls into the tick handler seems to handles things. You can scroll the panes slightly to see the faster moving progressbars, and size the form without locking up.
private bool inTimer = false;
private void timer_Tick(object sender, EventArgs e)
	this.inTimer = true;
	for (int rowIndex = 3; rowIndex < 14; rowIndex += 2)
		GridStyleInfo style = gridControl1[rowIndex, 2];
		GridProgressBarInfo progressBarEx= style.ProgressBar;
		int pvalue = (progressBarEx.ProgressValue + rowIndex)%100;
		progressBarEx.ProgressValue = pvalue;
	this.inTimer = false;

RY Ryan December 6, 2003 02:40 PM UTC

I made the changes to the sample and it still throws exceptions occasionally. It only seem to throw them now when I animate the progress bars, then create a split pane then close the split pane. When I close the split pane it throws the following exception. Is this easily fixed? System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: rowIndex at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType, Boolean dontRaiseSaveCellInfoEvent, Boolean copyReferenceOnly) at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType) at Syncfusion.Windows.Forms.Grid.GridModel.ChangeCells(GridRangeInfo range, GridStyleInfo[] cellsInfo, StyleModifyType modifyType) at Syncfusion.Windows.Forms.Grid.GridModel.Syncfusion.Windows.Forms.Grid.IGridVolatileDataContainer.ChangeCell(Int32 rowIndex, Int32 colIndex, GridStyleInfo style) at Syncfusion.Windows.Forms.Grid.GridVolatileData.set_Item(Int32 rowIndex, Int32 colIndex, GridStyleInfo value) at Syncfusion.Windows.Forms.Grid.GridStyleInfoIdentity.OnStyleChanged(StyleInfoBase style, StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.OnSubObjectChanged(IStyleInfoSubObject subObject) at Syncfusion.Styles.StyleInfoSubObjectBase.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.SetValue(StyleInfoProperty sip, Object value) at Syncfusion.Windows.Forms.Grid.GridProgressBarInfo.set_ProgressValue(Int32 value) at GridSample.MainForm.timer_Tick(Object sender, EventArgs e) in c:\program files\syncfusion\essential suite evaluation\grid\samples\celltypes\progressbarcells\cs\mainform.cs:line 402 at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr idEvent, IntPtr dwTime)

AD Administrator Syncfusion Team December 6, 2003 07:59 PM UTC

You need to add splitter_PaneCreated and splitter_paneClosing event to subscribe to the CurrentCellChanged event. If you don''t do this, then when you close a pane, the event is lost. You also have to change the CurrentCellChanged event handler to used the sender to get at the grid. Here is a new mainform.cs file with these changes.

Live Chat Icon For mobile
Up arrow icon