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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top