Hi Amil,
Other posters gave you the correct answer of your question already however,
I'd like to throw one other idea, which is applicable only to modal forms
(ShowDialog)
When you close a modal for the correct way to close the form is to set
form's DialogResult property to some of the DialogResult enum's values
different than DialogResult.None.
This will close the form, but not dispose it as long as with modal forms is
normal that you want to get some of its control's values back to the caller.
In other words the form is rather hidden. The DialogResult value you set is
going to be returned as a ShowDialog method's return value.
The caller must dispose the form when it's done. If you don't do any
processing on the button's (Ok, Cancel, Yes, No or whatever buttons you
have) Click event and the only thing you do is to close the dialog instead
of hooking on their Click event you can set buttons' DialogResult property
to relevant DialogResult value. This way when you click on the button the
framework will close the form and set form's DialogResult property for you.
You may alse take a look on the form's AcceptButton and CancelButton
properties. The former is the button, which click will be simulated when the
user presses ESC key and the latter is the button, which click will be
simulated when the user presses Enter key.