I am auto generating data grid and I am using check box in Data grid View,
Now i am invoking check box state changed event but it produces the following error

Handles clause requires a WithEvents variable defined in the containing type or one of its base types.

Here the code

Private Sub PRNT_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles PRNT.CheckedChanged
    Some Stuff.
    End Sub

When i changes this line

Private PRNT As New DataGridViewCheckBoxColumn

To this

Private Withevents PRNT As New DataGridViewCheckBoxColumn

Then error changes

Event 'CheckedChanged' cannot be found.

What could be the problem.

5 Years
Discussion Span
Last Post by Naveed_786

I have resolved my problem by using this method

Private Sub DataGridView1_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged
        If DataGridView1.CurrentCell.ColumnIndex = 15 Then 
        End If
    End Sub
Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
        'if sender is the checkbox column
        If e.ColumnIndex = 15 Then
            Dim frm As New frm_wo_byid_rep(txtwono.Text)
        End If
    End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.