To start I don't think you can do this. click is an asynchronous event and your If statement is synchronous. What I'm really saying here is that any goal of the above code is invalid so I would ask you to explain what it is you want to do.
If you wanted to know if a particular button
had been clicked when this If statement runs, then that is easy. Simply create a global boolean flag such as
bMyButtonWasClicked
In the button_click event set this value to TRUE and when your If Statement gets called it will be true only if the button event occurred. Be sure to set it to false inside your If code so it isn't just always true(unless thats what you want).
The other way is to reverse the logic and put your if statement inside the button_click event. If the IF statement runs then you know that the button_click event was called.
-
Private Sub button1_Click(sender As System.Object, e As System.EventArgs) Handles button1.Click
-
If intx = 1 then
-
'the rest of code
-
end if
-
-
End Sub
-