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

Exception caught when hiding/showing columns

Hi I have a number of tables in which columns dynamically needs to be shown and hidden. The tables have the first column frozen and are placed so that the will eventually scroll if too many columns are shown. This seems to work fine until a certain undefined point in which the following is printed in my debug view: catched at Syncfusion.Windows.Forms.Grid.GridModel.OnColsHidden(GridRowColHiddenEventArgs e) in :line 0 System.ArgumentException: '3' is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'. at System.Windows.Forms.ScrollBar.set_Value(Int32 value) at Syncfusion.Windows.Forms.ReflectScrollBar.set_Value(Int32 value) at Syncfusion.Windows.Forms.ScrollBarWrapper.set_Value(Int32 value) at Syncfusion.Windows.Forms.Grid.GridScroll.DoScroll(GridDirectionType direction, Int32 nCell) at Syncfusion.Windows.Forms.Grid.GridControlBase.SetLeftCol(Int32 colIndex) at Syncfusion.Windows.Forms.Grid.GridControlBase.set_LeftColIndex(Int32 value) at Syncfusion.Windows.Forms.Grid.GridScroll.ShowCols(Int32 colIndex, Int32 count) at Syncfusion.Windows.Forms.Grid.GridControlBase.ModelColsHidden(Object sender, GridRowColHiddenEventArgs e) at Syncfusion.Windows.Forms.Grid.GridRowColHiddenEventHandler.Invoke(Object sender, GridRowColHiddenEventArgs e) at Syncfusion.Windows.Forms.Grid.GridModel.OnColsHidden(GridRowColHiddenEventArgs e) This exception screws up my tables so that the table no longer responds to hiding and showing columns (It reports hidden columns as shown etc.) I have tried wrapping the hide/show calls in startupdate/endupdate and even suspend/resume-layout in the parent control, but nothing seems to work for me. Do you guys have any idea what I am doing wrong or if there is some way that I can avoid losing the ability to hide/show columns after this error? Unfortunately I can't send you our code that reproduces the issue, but I hope you have an idea to solve this (even hacks are acceptable at this point :)

3 Replies

AD Administrator Syncfusion Team April 23, 2004 07:03 AM UTC

Just something to try. Handle the LeftColChanging event. In your handler, check the e.Value. If it is invalid, then set e.Cancel = true (and maybe try explicitly setting grid.LeftColIndex to some valid value). This might avoid the problem. At worst, you could break on an invalid value and see if you can see what triggerred the invalid value back up in teh call stack using a debug build of our libraries.


JI Jimmy April 23, 2004 09:01 AM UTC

Thanks for the rapid reply, however I am not entirely sure that I am able to deduce when the e.Value of the LeftColIndexChanging event is invalid and what to set to LeftColIndex to. Should I specify the leftmost solumn that is set as visible or should I specify at what colindex the scrollbar should be scrolled to. I'm hoping you have the time to reply with a little info on how and what the LeftColIndex property does


JI Jimmy April 23, 2004 10:38 AM UTC

It seems that my specific problem was triggered when the first non-frozen column was hidden and other columns were shown/hidden I seem to have solved by problem (more or less elegantly) by always showing the column and I don't really have the time to write a test to see if this is a general issue or I have stumbled into some unfortunate condition. Anyway, just though you'd like to know

Loader.
Live Chat Icon For mobile
Up arrow icon