exiting constructor

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RickN

    #1

    exiting constructor

    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.Clos e() or return.

    Thanks,
    RN


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: exiting constructor

    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.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - nick(dot)paldin o=at=exisconsul ting<dot>com

    "RickN" <rick@abasoftwa re.com> wrote in message
    news:eZKzVmPiDH A.1864@tk2msftn gp13.phx.gbl...[color=blue]
    > 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[/color]
    initialized?[color=blue]
    > Can't use ParentForm.Clos e() or return.
    >
    > Thanks,
    > RN
    >
    >[/color]


    Comment

    Working...