private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (result) { MessageBox.Show("Success"); textBox1.ForeColor = SystemColors.GrayText; textBox1.Text = "Username"; textBox2.ForeColor = SystemColors.GrayText; textBox2.Text = "Old password"; textBox3.ForeColor = SystemColors.GrayText; textBox3.Text = "New password"; SlidePanel.Show(); SlidePanel2.Hide(); SlidePanel3.Hide(); panel4.BackColor = Color.Gainsboro; panel6.BackColor = Color.WhiteSmoke; panel2.BackColor = Color.WhiteSmoke; lblStatus.ForeColor = Color.Green; lblStatus.Visible = true; lblStatus.Text = "Done"; } else { MessageBox.Show("Could not update your password"); textBox1.ForeColor = SystemColors.GrayText; textBox1.Text = "Username"; textBox2.ForeColor = SystemColors.GrayText; textBox2.Text = "Old password"; textBox3.ForeColor = SystemColors.GrayText; textBox3.Text = "New password"; SlidePanel.Show(); SlidePanel2.Hide(); SlidePanel3.Hide(); panel4.BackColor = Color.Gainsboro; panel6.BackColor = Color.WhiteSmoke; panel2.BackColor = Color.WhiteSmoke; lblStatus.ForeColor = Color.Red; lblStatus.Visible = true; lblStatus.Text = "Error"; } }
private void textBox3_Enter(object sender, EventArgs e) { SlidePanel.Hide(); SlidePanel2.Hide(); panel4.BackColor = Color.WhiteSmoke; panel6.BackColor = Color.WhiteSmoke; textBox3.Clear(); panel2.BackColor = Color.Gainsboro; SlidePanel3.Show(); textBox3.Clear(); textBox3.ForeColor = SystemColors.WindowText; if (String.IsNullOrEmpty(textBox2.Text)) { textBox2.ForeColor = SystemColors.GrayText; textBox2.Text = "Old password"; } if (String.IsNullOrEmpty(textBox1.Text)) { textBox1.ForeColor = SystemColors.GrayText; textBox1.Text = "Username"; } }
public ChangePasswordForm() { InitializeComponent(); textBox1.ForeColor = SystemColors.GrayText; textBox1.Text = "Username"; textBox2.ForeColor = SystemColors.GrayText; textBox2.Text = "Old password"; textBox3.ForeColor = SystemColors.GrayText; textBox3.Text = "New password"; SlidePanel2.Hide(); SlidePanel3.Hide(); list = new List <User>(); result = false; bgWorker.DoWork += bgWorker_DoWork; bgWorker.ProgressChanged += bgWorker_ProgressChanged; bgWorker.RunWorkerCompleted += bgWorker_RunWorkerCompleted; }