Reputation: 3611
Private Sub cbtns_ClickButtonArea(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cbtn_a.ClickButtonArea, cbtn_b.ClickButtonArea, cbtn_c.ClickButtonArea, cbtn_d.ClickButtonArea
Dim cbtn As CButtonLib.CButton() = {cbtn_a, cbtn_b, cbtn_c, cbtn_d}
For Each cb As CButtonLib.CButton In cbtn
cb.Enabled = True
Next
End Sub
how to detect if what button did i clicked? i just want to disable the button i clicked or change it properties..
Upvotes: 0
Views: 426
Reputation: 47978
Private Sub cbtns_ClickButtonArea(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cbtn_a.ClickButtonArea, cbtn_b.ClickButtonArea, cbtn_c.ClickButtonArea, cbtn_d.ClickButtonArea
Dim cbtn As CButtonLib.CButton() = {cbtn_a, cbtn_b, cbtn_c, cbtn_d}
Dim clickedBtn As CButtonLib.CButton = DirectCast(sender, CButtonLib.CButton)
For Each cb As CButtonLib.CButton In cbtn
If cb Is clickedBtn Then
cb.Enabled = False
Else
cb.Enabled = True
End If
Next
End Sub
Upvotes: 1
Reputation: 108957
Try
CType(Sender, Button).Enabled = False
to disable the button that was clicked.
Upvotes: 1