You must Sign In to post a response.
  • Category: .NET

    Datagridview chekbox click event

    On datagridview check box checked I want to do addition of amounts and on unchecked need to do subtraction. I handled cell click and cell content click event but after simultaneous clicks its not working properly.
  • #684759
    can you post your code here so that we can give you proper solution.

  • #684761
    my code as given below and same for the cell content click event-

    Private Sub dgv_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellClick
    If Me.dgv.Rows(e.RowIndex).Cells("colSelect").Value = CheckState.Checked Then
    Me.dgv.Rows(e.RowIndex).Cells("colSelect").Value = CheckState.Unchecked
    decAmount = decAmount - Me.dgv.Rows(e.RowIndex).Cells("colBalance").Value
    Me.dgv.Rows(e.RowIndex).Cells("colSelect").Value = CheckState.Checked
    decAmount = decAmount + Me.dgv.Rows(e.RowIndex).Cells("colBalance").Value
    End If
    txtSelectAmt.Text = decAmount
    Catch ex As Exception
    throw ex
    End Try
    End Sub

    Thanks and Regards,
    Yogesh Brahmankar

  • #684765

    put the debugger and checked it. where it is going wrong exactly. and one more is don't read this multiple times declare var and assign to it so it is very easy for you to debug it.

    this.dgv.Rows(e.RowIndex).Cells("colSelect").Value and

    Rayala HariKishore achieved it.

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.