Click to See Complete Forum and Search --> : .Show versus .ShowDialog question.


vernonreeve
March 21st, 2005, 11:18 PM
I'm creating a Smart Client App that requires a signon screen. I currently have the signon screen as the first form. The Continue button will then call the main application form.
Should it open the main form using .Show or .ShowDialog?
Or am I doing this backwards in that I should have the main form get opened first, and have it immediately call a signon dialog form?

Thanks for any advice.

CoffeeMug
March 22nd, 2005, 04:01 AM
I'd go with the last solution, load main form first, have it create a new instance of your login form and call that with ShowDialog()

Andy Tacker
March 23rd, 2005, 04:11 AM
In your main() function. write something like this...

//flag for result
bool bResult = true;
//Authenticate the user
Login m_Login = new Login();
if (m_Login.ShowDialog() == DialogResult.Cancel)
bResult = false;
if (bResult)
{
m_Login.Close();
m_Login.Dispose();
Application.Run(new MainForm());
}
else
Application.Exit();