exiting constructor

  • Thread starter Thread starter RickN
  • Start date Start date
R

RickN

I want to test whether someone has the right to open
a form and need to test for this in the constructor. If they are not
permitted, I want to display a message and exit the form. The question is
how do I exit the form from the constructor before the form is initialized?
Can't use ParentForm.Close() or return.

Thanks,
RN
 
RickN,

In this case, you should throw an exception, and handle the exception in
whatever is calling the code. You can create a custom exception that
indicates that the user doesn't have permission to create the form.

Hope this helps.
 
Back
Top