Below is the code that I am using to reset the CheckBox value in a column within my DGV. My problem is that if the checkbox is already checked and the user tries to uncheck it...it won't actually be removed until the user clicks somewhere else in the DGV or checks another box. I'm not sure why this is happening. Obviously, I'm missing something else. Please help!
Thanks!
Code:Private Sub dgvBuild_CellContentClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvBuild.CellContentClick Try Select Case e.ColumnIndex Case 6 dgvBuild.ClearSelection() If dgvBuild.Rows(e.RowIndex).Cells(6).Value = True Then Dim answer As Integer = MessageBox.Show("Continue with Deletion?", "User Notification", MessageBoxButtons.YesNo) If answer = 6 Then If WIPD.DeleteWIP_Detail(dgvBuild.Rows(e.RowIndex).Cells(1).Value) Then dgvBuild.Rows.RemoveAt(e.RowIndex) dgvBuild.Rows.Remove(dgvBuild.CurrentRow) ReCalculateTotals(1) End If Else 'Uncheck the checkbox dgvBuild.Rows(e.RowIndex).Cells(6).Value = False End If End If End Select Catch ex As Exception strErrMsg = "frmProductBuild/dgvBuild_CellContentClick() - " & ex.Message MessageBox.Show(strErrMsg, "System Notification", MessageBoxButtons.OK) End Try End Sub


Reply With Quote

Bookmarks