protected void btnSubmit_Click(object sender, EventArgs e) { var userCredentials = new Credentials(txtName.Text, txtPassword.Text, int.Parse(txtAge.Text), txtEmail.Text); userCredentials.SaveCredentials(userCredentials); this.Controls.Clear(); }
public void SaveCredentials(Credentials credentials) { //StreamReader reader = new StreamReader("credentials.txt"); using (StreamWriter writer = new StreamWriter(@"C:\Users\colog_000\Desktop\credentials.txt", true)) { writer.WriteLine("Username: "******"Password: "******"Age: " + credentials.Age); writer.WriteLine("Email address: " + credentials.Email); writer.WriteLine(); } }