LoginForm (e.g. 2 textboxes, 1 button):
private void button1_Click (...)
{
// check for valid username and password
if (textBox1.Text == "someusername" .... )
{
this.DialogResult = DialogResult.OK
}
}
MainForm:
private void Form_Load (...)
{
LoginFrm frm = new LoginFrm ();
if (frm.ShowDialog (this) == DialogResult.OK)
{
// username and pass are OK
return;
}
else this.Close (); // close the form
}
Hope this helps
--
Regards,
Peter Jausovec
(
http://blog.jausovec.net)
"Marty" <ma********@absu.accenture.com> je napisal v sporocilo
news:11**********************@f14g2000cwb.googlegr oups.com ...
If I close the login form the whole application closes even if I load
the app form first. I can get around this by using frmApp.ShowDialog
so frmLogin.Close() dosen't happen until frmApp is closed but I
shouldn't have too.