private void buttonLoginSave_Click(object sender, EventArgs e) { ProfileLog log = ProfileLog.Create; Profile p = new Profile(); try { var x = new MailAddress(textBoxuserID.Text); p.Email = x.Address; p.Password = textBoxpassword.Text; } catch (FormatException) { textBoxErrorLogin.Text = "Email Format not Accepted"; return; } catch (ArgumentNullException) { textBoxErrorLogin.Text = "Email can not be empty"; return; } if (log.IsContainsProfile(p.Email) == true) { textBoxErrorLogin.Text = "Email is already reistered"; } else { log.Add(p); log.TurnActive(p.Email); comboBoxEmails.Items.Add(p.Email); textBoxErrorLogin.Text = "Succeded"; textBoxuserID.Text = ""; textBoxpassword.Text = ""; } }
private void comboBoxEmails_SelectedIndexChanged(object sender, EventArgs e) { ProfileLog log = ProfileLog.Create; log.TurnActive(comboBoxEmails.SelectedItem.ToString()); }