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
Yo can simply google for "exit sub in c#".
Also why would you check every text box if it is empty. You can place requiredfieldvalidator for these text boxes if this is an asp.net app and check if(Page.IsValid)
Or another solution is to get not of these conditions:
private void button1_Click(object sender, EventArgs e)
{
if (!(textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == ""))
{
//do events
}
}
And better use String.IsNullOrEmpty:
private void button1_Click(object sender, EventArgs e)
{
if (!(String.IsNullOrEmpty(textBox1.Text)
|| String.IsNullOrEmpty(textBox2.Text)
|| String.IsNullOrEmpty(textBox3.Text)))
{
//do events
}
}