Cordial greeting colleagues, it turns out that I have a CRUD in MS Visual Basic, connected to a database called quote, works perfectly, I use a checklistbox that is filled with the data of the bd and I also use it to select the records to those that I want to apply the update or delete, what I am trying to do now is some user validations and among them, that the update and delete button are deactivated when opening the form, this I do using the following statements in the load of the form:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
btnactualizar.Enabled = False
btneliminar.Enabled = False
End Sub
Now what I try to do is that if I select a content of the checklistbox, these buttons are enabled and if I remove this selection they are deactivated again. use this statement in the checklistbox:
Private Sub checklistestudios_SelectedIndexChanged(sender As Object, e As EventArgs) Handles checklistestudios.SelectedIndexChanged
If checklistestudios.SelectedIndex >= 0 Then
btnactualizar.Enabled = True
btneliminar.Enabled = True
ElseIf checklistestudios.SelectedIndex < 0 Then
btnactualizar.Enabled = False
btneliminar.Enabled = False
End If
End Sub
It works at the moment of selecting something in the checklistbox, activates the buttons, but if I remove the selection the buttons are still active and what I'm looking for is that they deactivate if there is nothing wrong in the checklistbox, how could I do it? / p>