I need to change a .click event of a button by clicking another, but I do not know how to do that. Making common method of Button1.Click = , the program gives me as error.
I'm doing it in VB.NET. How can I change the event settings in this way?
I need to change a .click event of a button by clicking another, but I do not know how to do that. Making common method of Button1.Click = , the program gives me as error.
I'm doing it in VB.NET. How can I change the event settings in this way?
To remove the event Button1_Click
RemoveHandler Button1.Click, AddressOf Button1_Click
To add the event NovoEvento_Click
AddHandler Button1.Click, AddressOf NovoEvento_Click
Assuming you have a method:
Sub ButtonClick(sender As Object, e As EventArgs)
End Sub
You can associate the event Click
as follows:
AddHandler Button1.Click, AddressOf ButtonClick