Ah yes. I tried it just now. It's working. Although I'm a bit uncomfortable with the outcome because in Java, we were taught not to ignore exceptions when it happens and so it must be handled properly. I guess this one is an exemption. Thanks!
Here's my reference: http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/6ee64b0c-c39e-4c79-a3d0-f3f73e5b2f73 Benj On Jul 8, 12:06 pm, Arsalan Tamiz <[email protected]> wrote: > Have you tried to use "DataError" event of DataGridView control? > > On Wed, Jul 8, 2009 at 8:02 AM, Benj Nunez <[email protected]> wrote: > > > Hello experts, > > > I encountered an issue similar to this: > > >http://www.codeguru.com/forum/showthread.php?t=418306 > > > The solution was to put code in the datagridview's Cell event handler > > which for me may not be applicable. I have a code like this: > > > DataSet dsQueryResult = null; > > dsQueryResult = service.doExecuteQuery(txtQueryInput.Text.Trim()); > > clearQueryResult(); > > > try > > { > > dgvQueryResult.DataSource = dsQueryResult.Tables[0]; > > } > > catch (Exception e) > > { > > // ...doesn't get here > > } > > > // an exception gets called afterwards. > > > I'm developing a program that is similar to a Query Browser for MS > > Access. You simply > > choose a table then write some sql code in a textbox then press a > > button to get > > a resultset. The resultset gets displayed to a datagridview. > > > The problem I'm having is that it seems there are columns/fields in > > the table that > > seems to be not being read quite correctly from the datagridview. How > > do I trap that exception? > > > Benj
