Advertisement
Guest User

Fullcode

a guest
Oct 17th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Premium_Manager
  12. {
  13. public partial class Form4 : Form
  14. {
  15.  
  16. public string username, password;
  17. public Form4()
  18. {
  19. InitializeComponent();
  20. }
  21.  
  22. private void button1_Click(object sender, EventArgs e)
  23. {
  24. this.Hide();
  25. Form5 f5 = new Form5();
  26. f5.Show();
  27. }
  28.  
  29. private void button2_Click(object sender, EventArgs e)
  30. {
  31. try
  32. {
  33. var sr = new System.IO.StreamReader("C:\\" + textBox1.Text + "\\login.pmid");
  34. username = sr.ReadLine();
  35. password = sr.ReadLine();
  36. sr.Close();
  37.  
  38. if (username == textBox1.Text && password == textBox2.Text)
  39. {
  40. MessageBox.Show("Your are now successfully logged in!", "Login Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
  41. this.Hide();
  42. Form1 f1 = new Form1();
  43. f1.ShowDialog();
  44. }
  45. else
  46. {
  47. MessageBox.Show("Username or password is wrong!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
  48. }
  49.  
  50. }
  51. catch (System.IO.DirectoryNotFoundException)
  52. {
  53. MessageBox.Show("The user doesn't exist", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
  54. }
  55.  
  56. }
  57.  
  58. private void Form4_Load(object sender, EventArgs e)
  59. {
  60.  
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement