Advertisement
khaiwen1111

assignnment code frag

Jun 26th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. private void Button1_Click(object sender, EventArgs e)
  2.         {
  3.             string username = textBox1.Text;
  4.             string password = textBox2.Text;
  5.             string holdername = textBox3.Text;
  6.             string phone = textBox4.Text;
  7.             string gender = comboBox1.SelectedItem.ToString();
  8.             string[] vals = { username, password, holdername, phone, gender, Environment.NewLine };
  9.  
  10.            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "")
  11.                 {
  12.                     MessageBox.Show("Textbox should not left empty");
  13.                     goto exit;
  14.                 }
  15.            else   using (StreamWriter sr = new StreamWriter("account.txt", true))
  16.                 {
  17.                     sr.Write(string.Join(" ", vals));
  18.                     MessageBox.Show("Account successfully created");
  19.                 }
  20.         exit:;
  21.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement