private void logoutButton_Click(object sender, EventArgs e) { Form f = this.FindForm(); f.Controls.Remove(this); LoginScreen ls = new LoginScreen(); HomePage hp = new HomePage(); f.Controls.Add(ls); ls.Location = new Point((f.Width - ls.Width) / 2, (f.Height - ls.Height) / 2); }
public Form1() { InitializeComponent(); LoginScreen ls = new LoginScreen(); this.Controls.Add(ls); }