SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 484 | Next

Scott Klein

"Professional LINQ"


Figure A-4
Ready to start adding some code? Open Form1 in design mode and double-click on any gray area of the
form to view the code. That also creates the Load() method for the form, which is what you need. In the
Load() event for the main form, add the following code:
string s = System.Reflection.Assembly.GetExecutingAssembly().Location;
s = Path.GetDirectoryName(s);
Directory.SetCurrentDirectory(s);
string businessName = Properties.Settings.Default.BusinessName;
this.Text = "Switchboard = " + businessName;
LoginForm lf = new LoginForm();
if (lf.ShowDialog() != DialogResult.OK)
{
Application.Exit();
}
For now, you are done with the main form. Open the login form in design mode, and double-click on the
OK button. In the button??™s Click() event, add the following code:
string username = txtUsername.Text.Trim();
string password = txtPassword.Text.Trim();
if ((username.Length > 0) && (password.Length > 0))
{
if (Authenticate(username, password))
{
DialogResult = DialogResult.OK;
}
318
Appendix A: Case Study
else
{
MessageBox.


Pages:
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6