Private Sub dgvBorrower_CellMouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles dgvBorrower.CellMouseUp
'Active เมื่อมีการคลิก Checkbox
If (e.ColumnIndex = 7) Then
dgvBorrower.EndEdit()
If dgvBorrower.Rows(e.RowIndex).Cells(7).Value Then
dgvBorrower.Rows(e.RowIndex).Cells(8).Value = "Yes"
Else
dgvBorrower.Rows(e.RowIndex).Cells(8).Value = "No"
End If
End If
End Sub
Private Sub CheckAllButton_Click(ByVal sender As Object, ByVal e As System.Windows.Forms.EventArgs) Handles CheckAllButton.Click
For Each row As DataGridViewRow In dgvBorrower.Rows
Dim chk As DataGridViewCheckBoxCell = DirectCast(row.Cells(7), DataGridViewCheckBoxCell)
chk.Value = True
Next
End Sub
Private Sub dgvBorrower_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvBorrower.CellValueChanged
If e.ColumnIndex = 7 Then
Dim chk As DataGridViewCheckBoxCell = DirectCast(dgvBorrower.Rows(e.RowIndex).Cells(7), DataGridViewCheckBoxCell)
dgvBorrower.Rows(e.RowIndex).Cells(8).Value = If((chk.Value = True), "Yes", "No")
End If
End Sub