I'm new to c#. Got a log-in system with registration project. Having trouble with the forms.
I have 2 forms, form1 and form2. Form1 is my main form, my log-in form. Form2 is the registration form.
So this is how the application runs: Before form1 shows, there is a condition first to be met. If the condition is met, message box will appear then form2 will show. However, when the condition is not met form1 will show.
So the problem is, form1 keeps showing although the condition is met. Form2 appears but form1 appears too.
private void Form1_Load(object sender, EventArgs e)
{
if (condition)
{
MessageBox.Show("Message");
this.Hide();
Form2 frm = new Form2();
frm.Show();
}
}