private void loginButton_Click(object sender, EventArgs e) { if (userTextBox.Text == username && passTextBox.Text == password) { Form f = this.FindForm(); f.Controls.Remove(this); homePage hp = new homePage(); f.Controls.Add(hp); hp.Location = new Point((f.Width - hp.Width) / 2, (f.Height - hp.Height) / 2); } else { label3.Text = "There are no mistakes, just happy accidents"; userTextBox.Text = ""; passTextBox.Text = ""; } }