I have a button click event handler with the following pseudo code:
private void btnSave_Click(object sender, EventArgs e) { if(txt.Text.length == 0) this.Close(); else
It's just some simple code, but the fact is that when the length of the text is zero, I want to close the form. But instead of closing the form, the code executes part // Another code. After the click event handler is fully executed, the form closes.
I know when I put return right after this.Close() , the form closes, but I would like to know WHY the form is not closed when you call this.Close() . Why is the rest of the event handler processing done?
c # winforms
Martijn
source share