How to close a Form from onload event

A

Anoop

I am trying to close the form after validation in the onload event.
I tried both Windows.Close and XDocument.Close() . neither one works.

Any other alternative? My requirement is to prevent user from working with
the form if the validation fails.

Thanks in advance.
Anoop
 
A

Anoop

I have already tried thisApplication.XDocuments.Close and Window.Close()

Is there anyway I can do some validations and the restrict the user from
using the form. other than in the onload event , if closing form is not
possible from onload?

regards
Anoop
 
K

Kalyan Reddy

Hi Anoop,

Do you want to close the form with validations in Onload event??
thisApplication.XDocuments.Close( ) will not allow the form to be closed
with validations on.

One way is collect all errors and delete them with this method
XDocument.Errors.DeleteAll();
and then use
thisApplication.XDocuments.Close

Hope I understood you correctly.
 
A

Anoop

Kalyan,

I am not talking about form validations. I check for the user and want
to restrict for a particular user. So I need just a method to close the form
in onload event.

Anoop
 
Top