i know that in vb.net you can just do Exit Sub
but i would like to know how do i exit a click event in a button?
here\'s my code:
pr
Use the return keyword.
From MSDN:
The return statement terminates execution of the method in which it appears and returns control to the calling method. It can also return the value of the optional expression. If the method is of the type void, the return statement can be omitted.
So in your case, the usage would be:
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
{
return; //exit this event
}
}