Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button2_Click(object sender, EventArgs e)
- {
- Form2 form2 = new Form2();
- form2.Show();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- var sr = new System.IO.StreamReader("C\" + textBox1.Text + "\login.ID");
- username = sr.ReadLine();
- password = sr.ReadLine();
- sr.Close();
- if (username == textBox1.Text && password == textBox2.Text)
- MessageBox.Show("Log-in Successfull", "Success!");
- else
- MessageBox.Show("Username or password is wrong! ","Error!");
- }
- catch (System.IO.DirectoryNotFoundException )
- {
- MessageBox.Show("The user doesn't exist!", "Error!");
- }
- }
- }
- public partial class Form2 : Form
- {
- public Form2()
- {
- InitializeComponent();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- Form2 form2 = new Form2();
- form2.Hide();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- var sw = new System.IO.StreamWriter ("C\" + textBox1.Text + "\login.ID");
- sw.Write(textBox1.Text + "n" + textBox2.Text);
- sw.Close();
- }
- catch(System.IO.DriveNotFoundException )
- {
- System.IO.Directory.CreateDirectory("C:\" + textBox1.Text);
- var sw = new System.IO.StreamWriter("C\" + textBox1.Text + "\login.ID");
- sw.Write(textBox1.Text + "n" + textBox2.Text);
- sw.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement