1

i'm creating two forms in C#; one is the startup form, and the other one is the main form. I want to give a setting in the main form with a Checkbox, and i want it to show the startup form when it is checked. And when it is not, it will not show the startup form and continue directly to the main form. Here's the screenshot i've provided regarding the setting i've made:

Here's the code i've managed to make so far :C

private void checkBox4_CheckedChanged(object sender, EventArgs e)
    {
        if (checkBox4.Checked == true)
        {
            Startup s = new Startup();
            s.Visible = true;
        }
        if (checkBox4.Checked == false)
        {
            Startup s = new Startup();
            s.Visible = false;
        }
    }

Can anyone please help. thanks.

Robin
  • 127
  • 10
  • What happens when you run this code? As you don't show what Startup is or does, it is difficult to see what should happen. – Rob Anthony Aug 11 '17 at 11:40
  • When i run the program, i unchecked the checkbox(before that i set it to checked). and i closed the program then run it again - and the same startup form showed up. I went to the checkbox main form and saw that the setting worked because it was unchecked. – Robin Aug 11 '17 at 11:59

0 Answers0