Hello,
I've looked for this subject and found various examples but can't put them to work.
So, i need help to understand what i'm doing wrong.
I have a datagridview, with 9 columns. The 1st column is a checkbox. Then i have 2 buttons, one disabled and only want to enable it when the user check's one column.
If the user check's more than one checkbox, the button stays disabled.
The code i have to see if a checkbox is checked is the following:
Thanks
I've looked for this subject and found various examples but can't put them to work.
So, i need help to understand what i'm doing wrong.
I have a datagridview, with 9 columns. The 1st column is a checkbox. Then i have 2 buttons, one disabled and only want to enable it when the user check's one column.
If the user check's more than one checkbox, the button stays disabled.
The code i have to see if a checkbox is checked is the following:
Private Sub DGVSites_CellContentClick(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles DGVSites.CellContentClick CntCheck = 0 'Count the number of rows checked For Each Row As DataGridViewRow In DGVSites.Rows If Row.Cells("DGVChkBox").Value = True Then CntCheck += 1 End If Next 'S? tornamos o bot?o de alterar visivel caso haja s? uma linha selecionada If CntCheck = 1 Then BtnAlterar.Visible = True DGVSites.Refresh() Else BtnAlterar.Visible = False DGVSites.Refresh() End If End Sub
Thanks