showdialog login form - login fail, close the app

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a simple MDIChild login form that loads before the parent, and if the
user hit's the cancel button on the login form, the whole app should unload.
How can I do this? Thanks
 
Walter said:
Hi,
I have a simple MDIChild login form that loads before the parent, and
if the user hit's the cancel button on the login form, the whole app
should unload. How can I do this? Thanks

Code the cancel button to set your form's DialogResult to
DialogResult.Cancel before closing itself. In the calling routine, bail
if the user cancelled.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
Thanks!
Frank Oquendo said:
Code the cancel button to set your form's DialogResult to
DialogResult.Cancel before closing itself. In the calling routine, bail
if the user cancelled.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
Got time for one more? How can I set a property on the mdiParent form from
the Child form?
thanks.
 
Pass the parent as a paramter when you create the child.

MyChild newChild = new MyChild(this);

And add or change the constructor on the child class to accept a parent
parameter

private Parent parent;

public MyChild(Parent parent)
{
this.parent = parent;
}

then call parent.Property when you need it
 
Sorry, I keep getting the below error on these lines:

private Parent parent;
public MyChild(Parent parent)

'System.Windows.Forms.Control.Parent' denotes a 'property' where a 'class'
was expected

thanks.

Pass the parent as a paramter when you create the child.

MyChild newChild = new MyChild(this);

And add or change the constructor on the child class to accept a parent
parameter

private Parent parent;

public MyChild(Parent parent)
{
this.parent = parent;
}

then call parent.Property when you need it
 
Back
Top