Guest User

Untitled

a guest
Apr 17th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. private void btn_loguserin_Click(object sender, EventArgs e)
  2. {
  3. string userName;
  4. string userPassword;
  5.  
  6. userName = txtbx_username.Text;
  7. userPassword = txtbx_password.Text;
  8.  
  9. if (userName == "" || userPassword == "")
  10. {
  11. txtbx_username.Text = "MISSING INPUT";
  12. }
  13. else
  14. {
  15. LogIn loginStatus = LogIn.getInstance();
  16. byte runLevel = loginStatus.LogMeIn(userName, userPassword);
  17. if (runLevel > 0)
  18. {
  19. Form1 form1 = Application.OpenForms["Form1"] as Form1;
  20. if (form1 == null)
  21. {
  22. Console.WriteLine("Form is null!");
  23. // !!! Throw an exception here !!!
  24. }
  25. else
  26. {
  27. form1.runLevelChecker();
  28. }
  29. }
  30. else
  31. {
  32. txtbx_username.Text = "INVALID LOGIN";
  33. }
  34.  
  35. Form1 form1 = Application.OpenForms["Form1"] as Form1;
Add Comment
Please, Sign In to add comment