Return a value from a child Form
Hopefully a simple one, but is perplexing me ...
I have a main class that calls a logon form to validate users against a DB backend...
The login form works fine but from my main class I want to return a value ( true or false ) from the login form to either allow the main MDI form to run or terminate the application.
Not sure if my approach is correct, in fact being new to C# struggling quite alot with scope in general .. but any pointers gratefully received
TIA Dave
Main Cls
frmLogon myfrmLogon =new frmLogon();
bool myretval = myfrmLogon.Show(); //Cannot implicitly convert type 'void' to 'bool' error here
Logon Form
private bool logon;
private void frmLogon_Load(object sender, System.EventArgs e)
{
logon = false;
}
///// Various logon form code removed that sets the logon varivle true or false
private bool frmLogon_Closing(object sender,System.ComponentModel.CancelEventArgs e)
{
return logon;
}