Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Datagrid control bug

We have an app with several datagrid controls.  If you position your mouse in the row header between two rows like you were going to resize a row and then double-click the datagrid control throws an exception.  Our app relies on being able to double click on a row in the row header, and this is easy to do unintentionally.  Has anyone else seen this error?  How can you trap it?

Joel Coehoorn
Friday, March 18, 2005

That doesn't happen with my grids.  Is this Winforms or Webforms?  What version of .NET?  Whats the exception?

If it really is a bug I guess you could just catch the exception and not do anything.

CharlesC
Friday, March 18, 2005

It's windows forms, .Net v1.1.  The only place I've found we can catch the exception is the call to show or showdialog, and the dialog still  closes at this point.  If it happens on our main form the app hangs.

"The " DataGridColumnStyle cannot be used because it is not associated with a Property or a Column in the DataSource."

System.InvalidOperationException

Joel Coehoorn
Friday, March 18, 2005

Double clicking the RowHeader resize area works fine for me (as expected, it resizes the row to the content if it needs to, otherwise does nothing).  My guess is that your double click handler isn't properly handling cases where the HitTest returns Type = RowResize or Row = -1. 

SomeBody
Saturday, March 19, 2005

I put a  breakpoint at the first line of the event handler and it crashes before ever reaching the breakpoint.

Joel Coehoorn
Monday, March 21, 2005

I have the same problem, did you ever overcome this issue?

Cheers,

DannyT
Thursday, April 14, 2005

*  Recent Topics

*  Fog Creek Home