jalajakshi p

jalajakshi p

  • NA
  • 12
  • 0

Textbox validate event should not fire when I close the form

May 4 2009 9:37 AM

Hi,

In windows application(c#) I am having a form which contains two textboxes.

For one textbox I have created validate event.like below

private void txtProposedNextDueDate_Validating(object sender, CancelEventArgs e)

{

if (txtProposedNextDueDate.Text == "")

{

MessageBox.Show("Please enter valid date"); txtProposedNextDueDate.Focus();

}

}

But when I want to close the form without entering any value,then also it is showing the messagebox and then it is closing the form.

So when I close the form I dont want to validate the textbox.Simply it should close the form without showing message.


Answers (4)