Guest User

Untitled

a guest
Jun 30th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 KB | None | 0 0
  1.         private void button1_Click(object sender, EventArgs e)
  2.         {
  3.             string Username = tbUser.Text;
  4.             string Password = tbPassword.Text;
  5.             string path = @"C:/data.txt";
  6.             string NewUser = "New User......";
  7.             if (!System.IO.File.Exists(path))
  8.             {
  9.                 System.IO.File.Create("C:/data.txt");
  10.             }
  11.  
  12.             string line1, line2, line3, line4, line5, line6, line7, line8, line9, line10;
  13.             using (StreamReader reader = new StreamReader(path))
  14.             {
  15.                 line1 = reader.ReadLine();
  16.                 line2 = reader.ReadLine();
  17.                 line3 = reader.ReadLine();
  18.                 line4 = reader.ReadLine();
  19.                 line5 = reader.ReadLine();
  20.                 line6 = reader.ReadLine();
  21.                 line7 = reader.ReadLine();
  22.                 line8 = reader.ReadLine();
  23.                 line9 = reader.ReadLine();
  24.                 line10 = reader.ReadLine();
  25.             }
  26.             if (cb1.Text == NewUser && (line1 == ""))
  27.             {
  28.                 tbUser.Text = "Username";
  29.                 tbPassword.Text = "Password";
  30.             }
  31.             else if (cb1.Text == NewUser && (line4 == ""))
  32.             {
  33.                 tbUser.Text = "Username";
  34.                 tbPassword.Text = "Password";
  35.             }
  36.             else if (cb1.Text == NewUser && (line6 == ""))
  37.             {
  38.                 tbUser.Text = "Username";
  39.                 tbPassword.Text = "Password";
  40.             }
  41.             else if (cb1.Text == NewUser && (line8 == ""))
  42.             {
  43.                 tbUser.Text = "Username";
  44.                 tbPassword.Text = "Password";
  45.             }
  46.             else if (cb1.Text == NewUser && (line10 == ""))
  47.             {
  48.                 tbUser.Text = "Username";
  49.                 tbPassword.Text = "Password";
  50.             }
Add Comment
Please, Sign In to add comment