I want to after clicking on button2,after that if i click on button1 then msg is not displayed
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("sonia")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
RemoveHandler Button2.Click, AddressOf MYEVENTHandler
End Sub
Private Sub MYEVENTHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
End Class
In your Form Load, setup the event handler for Button1. So, remove the statement
Handles Button1.Click at the end of the Button1.Click procedure.
In your Form_Load place the following:
Addhandler Button1.Click, AddressOf MYEVENTHandler
In your MYEVENTHandler place the following code:
msgbox ("sonia")
In the Button2_Click, use the existing code you have, it will work.
Hope this helps.