I am a tad new to the DataGrid controls, but I am just curious as to why the first code block below works, but the second code block does not? (Only thing I can see is the Handles DataGridClaims syntax
Block 1
Private Sub DataGridClaims_CellContentClick_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridClaims.CellContentClick
    If e.RowIndex <> -1 Then
        Dim frmViewClaims As New objViewClaim
        frmViewClaims.ClaimID = DataGridViewClaims.CurrentRow.Cells("ClaimNum").Value
        frmViewClaims.Show()
    End If
End Sub
Block 2
Private Sub DataGridClaims_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
    If e.RowIndex <> -1 Then
        Dim frmViewClaims As New objViewClaim
        frmViewClaims.ClaimID = DataGridViewClaims.CurrentRow.Cells("ClaimNum").Value
       开发者_如何转开发 frmViewClaims.Show()
    End If
End Sub
The "handles" keyword in VB.net marks the Function as a listener to the given event. Without the "Handles DataGridClaims", the grid has no way to know to fire your function when the event is triggered.
[See MSDN Doc's][1] http://msdn.microsoft.com/en-us/library/6k46st1y(v=VS.100).aspx
I am not too familiar with the VB.NET, but CellContentClick is an event which occurs when the content within a cell is clicked. 
In order for the program to understand that this is an event you use the keyword Handles in VB.NET. It allows you to wire-up the bindings to event handlers on the event handler methods themselves.
This is the equivalent of += in c# and would look something like
DataGridClaims.CellContentClick += DataGridClaims_CellContentClick;
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论