Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Dbl click btw rows in grid?
 

Dbl click btw rows in grid?

Hi,
Some time double click between rows on data grid cause UnHandeled exceptions.
Any body experianced this? How could avoid/ignore that?
MigrationUser 1  Friday, July 18, 2003 5:20 PM
Are you doing anything in the double click event of the grid?
MigrationUser 1  Friday, July 18, 2003 5:23 PM
Yes, to load another form. But not using DblClick. I used MouseDown event with click=2 to capture dblClick.
MigrationUser 1  Tuesday, July 22, 2003 6:43 PM
Is there anything in either your MouseDown code or the Loading of the other form that would result in this error?
MigrationUser 1  Tuesday, July 29, 2003 4:50 PM
This happen as soon as reachs the end of  _MouseDown event, when i debug(trace) the program. the event method looks like following: 

  Private Sub CIGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles CIGrid1.MouseDown

        If e.Clicks = 2 Then
            Dim hi As DataGrid.HitTestInfo
            Dim g1 As DataGrid = CType(sender, DataGrid)
            hi = g1.HitTest(e.X, e.Y)
            If ((hi.Type = CIGrid1.HitTestType.RowHeader) Or (hi.Type = CIGrid1.HitTestType.Cell)) And (hi.Type <> CIGrid1.HitTestType.ColumnHeader) Then

                FormLoader()  '// call a method to load the form
            End If
        End If

    End Sub


the program skips "If e.Clicks = 2....." when dbl clicked on btw rows, then raises UnHandledException when "End Sub" reached.   

MigrationUser 1  Tuesday, July 29, 2003 6:44 PM
Strange. . . Do you have any additional exception information?  Place a Try...Catch around the contents of the handler:

Private Sub CIGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles CIGrid1.MouseDown 

Try
     If e.Clicks = 2 Then 
          Dim hi As DataGrid.HitTestInfo 
          Dim g1 As DataGrid = CType(sender, DataGrid) 
          hi = g1.HitTest(e.X, e.Y) 
          If ((hi.Type = CIGrid1.HitTestType.RowHeader) Or (hi.Type = CIGrid1.HitTestType.Cell)) And (hi.Type <> CIGrid1.HitTestType.ColumnHeader) Then 

               FormLoader() '// call a method to load the form 
          End If 
     End If 
Catch x As Exception
     Messagebox.Show(x.Message)
     Messagebox.Show(x.StackTrace)     
End Try

End Sub 


and see if the exception catches and what it's contents are.  It looks like an MS bug to me based on your code and description, so, maybe we can find a workaround for you.
MigrationUser 1  Wednesday, July 30, 2003 11:53 AM
I already tried that. For some reason which i don't know why, the catch could not capture UnhandleException.
MigrationUser 1  Wednesday, July 30, 2003 4:50 PM
Can you catch Application.ThreadException or AppDomain.UnhandledException ?
MigrationUser 1  Wednesday, July 30, 2003 5:07 PM

You can use google to search for other answers

Custom Search

More Threads

• Datasources not showing when on a form in VS release candidate
• Datagrid ComboBox only for a Cell
• How to Show Image in Datagridview cells
• DataGridView - Stop User Selecting Cells
• Help: Datagridview is not show all data!!!
• How To get the DataGridView Row data and Insert it to a new Table
• ListView DragDrop Index
• DataGridView RowValidating doesn't show the ErrorText icon
• How do I open another form from datagrid when click on the row?
• SQLDataSource - setting parameter values in code