-
krishnav said 1 year, 9 months ago:
Hi,
I am using True DB Grid version 2.0.20083.61151, in one of my application.Is there any way I can catch all these kind of exceptions from grid, instead of crashing the app. like Grid 'Error’ event. Will 'Error’ event handle all varieties of errors/exceptions from TrueDBGrid?
It come to my notice that, my app is crashing with the following exceptions from TrueDB grid randomly. There are no specific steps in re-producing this. This is so random. I am not able to re-create this behavior on my machine.
Here are the call stack(s),
Stack #1:
Message: Message: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index; StackTrace: at System.Collections.ArrayList.get_Item(Int32 index)
at C1.Win.C1TrueDBGrid.BaseGrid.ViewRowList.get_Item(Int32 index)
at ee.d(Int32 A_0, Int32 A_1)
at C1.Win.C1TrueDBGrid.BaseGrid.View.an(Int32 A_0)
at C1.Win.C1TrueDBGrid.BaseGrid.View.keyRight(Boolean eval)
at C1.Win.C1TrueDBGrid.BaseGrid.View.keyRight()
at C1.Win.C1TrueDBGrid.Split.keyRight()
at C1.Win.C1TrueDBGrid.BaseGrid.View.OnKeyDown(KeyEventArgs e)
at C1.Win.C1TrueDBGrid.Split.OnKeyDown(KeyEventArgs e)
at C1.Win.C1TrueDBGrid.BaseGrid.View.OnEditKey(KeyEventArgs e)
at C1.Win.C1TrueDBGrid.BaseGrid.View.EditKeyPress(KeyPressEventArgs e)
at C1.Win.C1TrueDBGrid.Split.EditKeyPress(KeyPressEventArgs e)
at C1.Win.C1TrueDBGrid.BaseGrid.View.a(Object A_0, KeyPressEventArgs A_1)
at System.Windows.Forms.Control.OnKeyPress(KeyPressEventArgs e)
at e7.OnKeyPress(KeyPressEventArgs e)
at C1.Win.C1TrueDBGrid.GridEditor.OnKeyPress(KeyPressEventArgs e)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
at System.Windows.Forms.Control.WmKeyChar(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)Stack #2:
Message: Message: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index; StackTrace: at System.Collections.ArrayList.get_Item(Int32 index)
at C1.Win.C1TrueDBGrid.BaseGrid.ViewRowList.get_Item(Int32 index)
at ee.d(Int32 A_0, Int32 A_1)
at C1.Win.C1TrueDBGrid.BaseGrid.View.an(Int32 A_0)
at C1.Win.C1TrueDBGrid.Split.OnClick(Point p)
at dn.d(Point A_0)
at C1.Win.C1TrueDBGrid.BaseGrid.Frame.doClick(EventArgs e)
at C1.Win.C1TrueDBGrid.C1TrueDBGrid.doClick(EventArgs e)
at C1.Win.C1TrueDBGrid.BaseGrid.Frame.OnClick(EventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at C1.Win.C1TrueDBGrid.BaseGrid.Frame.WndProc(Message& m)
at C1.Win.C1TrueDBGrid.C1TrueDBGrid.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)Thanks in advance.
–Krishna
| # -
Hi Krishna,
C1TrueDBGrid.Error Event occurs whenever an exception is thrown during 'end user interaction’. You may put in your code for custom check in that event and set its Handled property to true.
I can’t provide you with a specific reason for this exception just by looking at the stack trace. However, I’ve encountered similar exceptions while remove item(s) from a collection while iterating through the same in a, say, ForEach-loop; thereby modifying the collection.
Now, this is not specific for the grid, or for any specific component, for that matter. If you remove a DataRow from a any DataTable while traversing through the DataRow collection, or if you implementing the same operation with a DataColumn collection, you’d get the same exception.
Please look out for the same in your app.
I don’t really think that this is going to help; but, there’s no harm is trying the same with the latest build available at
http://prerelease.componentone.com/dotnet20/C1TrueDBGrid/2011-T2/C1TrueDBGrid.2_2.0.20112.61226.zip
~Anupam.
| # -
krishnav said 1 year, 9 months ago:
Thanks for the reply. It is difficult for us to switch the grid version at this stage of our cycle. atleast difficult to convince.
By looking at the Call stack, per sure it is coming from the True DB Grid only. I think, the exception u r talking about is "Invalid operation exception" with a message, Collection modified, if collection is modified while iterating the same.
Iam seting the FilterBar = true and my grid is non editable and only place use can edit is the filter bar and on editing the filter underlying text box control is throwing some exception (my guess). Here is the part of the exception.
at System.Windows.Forms.Control.OnKeyPress(KeyPressEventArgs e)
at e7.OnKeyPress(KeyPressEventArgs e)
at C1.Win.C1TrueDBGrid.GridEditor.OnKeyPress(KeyPressEventArgs e)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)By any chance, If I have the Grid 'Error’ event handler, will Grid fire 'Error’ event on scenarios like above? Unfortunately, I am not finding enough documentation on this event.
I am not sure when exactly the 'Error’ event will fire. Can you share some samples.
Thanks,
Krishna| #
You must be logged in to reply to this topic.

