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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Exception handling

Thread ID:





2626 Feb 5,2003 04:49 PM UTC Apr 6,2005 07:10 PM UTC WinForms 3
Tags: GridControl
Shawn Oles
Asked On February 5, 2003 04:49 PM UTC

I have an OnChangeHandler for a GridListControl: private void ManagedObjects_SelectedValueChanged(object sender, System.EventArgs e) { DoSomething(); } In the DoSomething() call an exception is thrown (System.IO.FileNotFoundException), but I did not get the standard Debug "unhandled exception message box". Examing the debug output window, I can see that this exception is being caught by the grid. My question is, is this expected behavior? Also, the application simply locked up and had to be end tasked to exit. Apparently the catch hanlder that is catching this exception is not handling it gracefully. Adding a try catch block seems to solve the lock up issue, and I realize that I will have to handle all exceptions that are thrown, it was just a bit confusing to have it caught by the component. I guess it also means that all hanlders should be enclosed in try, catch blocks.. ? From Output Windows: System.IO.FileNotFoundException: Could not find file "C:\Projects\DataTable\bin\Debug\X_SPP_CUSTOMER_SURVEY.xml". File name: "C:\Projects\DataTable\bin\Debug\X_SPP_CUSTOMER_SURVEY.xml" at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) at System.Xml.XmlTextReader.CreateScanner() at System.Xml.XmlTextReader.Init() at System.Xml.XmlTextReader.Read() at System.Xml.XmlReader.MoveToContent() at System.Data.DataSet.ReadXml(XmlReader reader) at System.Data.DataSet.ReadXml(String fileName) at CamSchemaBuilder.SchemaBuilder.ReadCamFields(String TableName, CamSchema SPPSchema) in c:\projects\datatable\schemabuilder.cs:line 219 at CamSchemaBuilder.DBObjectBuilder.ManagedObjects_SelectedValueChanged(Object sender, EventArgs e) in c:\projects\datatable\dbobjectbuilder.cs:line 325 at System.Windows.Forms.ListControl.OnSelectedValueChanged(EventArgs e) at Syncfusion.Windows.Forms.Grid.GridListControl.OnSelectedValueChanged(EventArgs e) at System.Windows.Forms.ListControl.OnSelectedIndexChanged(EventArgs e) at Syncfusion.Windows.Forms.Grid.GridListControl.OnSelectedIndexChanged(EventArgs e) at Syncfusion.Windows.Forms.Grid.GridListControl.set_SelectedIndex(Int32 value) at Syncfusion.Windows.Forms.Grid.GridListControl.GridCurrentCellActivated(Object sender, EventArgs e) at Syncfusion.Windows.Forms.Grid.GridControlBase.OnCurrentCellActivated(EventArgs e) at Syncfusion.Windows.Forms.Grid.GridControlBase.RaiseCurrentCellActivated() at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Activate(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options, Boolean discardChanges) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.Internal.GridSelectCellsMouseController.MouseDown(MouseEventArgs e) at Syncfusion.Windows.Forms.MouseControllerDispatcher.ProcessMouseDown(MouseEventArgs e) at Syncfusion.Windows.Forms.ScrollControllMouseControllerDispatcher.ScrollControlBeforeMouseDown(Object sender, CancelMouseEventArgs e) at Syncfusion.Windows.Forms.CancelMouseEventHandler.Invoke(Object sender, CancelMouseEventArgs e) at Syncfusion.Windows.Forms.ScrollControl.OnBeforeScrollControlMouseDown(CancelMouseEventArgs e) at Syncfusion.Windows.Forms.Grid.GridControlBase.OnBeforeScrollControlMouseDown(CancelMouseEventArgs e) at Syncfusion.Windows.Forms.ScrollControl.RaiseCancelMouseEvent(MouseEventArgs e, CancelMouseDelegate d) catched at Syncfusion.Windows.Forms.ScrollControl.RaiseCancelMouseEvent(MouseEventArgs e, CancelMouseDelegate d) in :line 0

Administrator [Syncfusion]
Replied On February 5, 2003 07:39 PM UTC

Hi Shawn, the grid needs to catch quite a few exceptions, otherwise the drawing or moving the current cell would get too messed up. That said, we see that the current practice that we have implemented with catching these exceptions has quite a few disadvantages and you should expect a change with this design in the 2.0 version. We'll provide them some kind of hook that will let you handle exceptions or enforce having exceptions fall through all the way. So, for now you would have to enclose your DoSomething call with your own try/catch exception block. Stefan

Kenny Louie
Replied On April 6, 2005 06:50 PM UTC

Is there allow to allow the exceptions through the grid yet?

Administrator [Syncfusion]
Replied On April 6, 2005 07:10 PM UTC

Here is a KB on how to manage exceptions in the grid. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=11&catId=2


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon