I have an unbound radgridview that I populate from a .CSV file.
I used AddCheckboxColumn() code I found in this forum to add a 'Select All' header checkbox.
I have two issues.
I want to enable and disable a button on the form based on 'all checkboxes cleared' = disabled and 'all checkboxes selected' = enabled
I can do this by adding ...
If valueState = False And frmClientsImport.btnAddToDB.Enabled = True Then
frmClientsImport.btnAddToDB.Enabled = False
ElseIf valueState = True And frmClientsImport.btnAddToDB.Enabled = False And Not frmClientsImport.cboCustomers Is Nothing Then
frmClientsImport.btnAddToDB.Enabled = True
End If
...to Private Sub checkbox_ToggleStateChanged(ByVal sender As Object, ByVal args As StateChangedEventArgs)
but this is obviously not the way to do it because then I've kind of locked the subroutine to the specific radgridview.
Second, if an individual checkbox is selected/deselected I want to enable the same button as long as at least one row has a checkbox checked and disable the button if no rows have the checkbox checked. I tried the .ValueChanged event but it doesn't seem to report the state correctly.
I used AddCheckboxColumn() code I found in this forum to add a 'Select All' header checkbox.
I have two issues.
I want to enable and disable a button on the form based on 'all checkboxes cleared' = disabled and 'all checkboxes selected' = enabled
I can do this by adding ...
If valueState = False And frmClientsImport.btnAddToDB.Enabled = True Then
frmClientsImport.btnAddToDB.Enabled = False
ElseIf valueState = True And frmClientsImport.btnAddToDB.Enabled = False And Not frmClientsImport.cboCustomers Is Nothing Then
frmClientsImport.btnAddToDB.Enabled = True
End If
...to Private Sub checkbox_ToggleStateChanged(ByVal sender As Object, ByVal args As StateChangedEventArgs)
but this is obviously not the way to do it because then I've kind of locked the subroutine to the specific radgridview.
Second, if an individual checkbox is selected/deselected I want to enable the same button as long as at least one row has a checkbox checked and disable the button if no rows have the checkbox checked. I tried the .ValueChanged event but it doesn't seem to report the state correctly.