Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8175561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:49:44+00:00 2026-06-06T22:49:44+00:00

I have five buttons on one form that when clicked enables a bool each

  • 0

I have five buttons on one form that when clicked enables a bool each to be true or false, they also load a new form. When that form is loaded I need the new form to check first which of those bools are true or false. This will then lead to the form loading the correct data.

I set the bools to public thinking that this would work, and in the form2_load i checked which one is true. however this does not seem to work. I tried first by just changing a label and it’s text. The text doesn’t changed and I don’t think the bools are being read or checked.

Does anyone know what the problem could be?

Form1 code:

public bool Room1;
public bool Room2;
public bool Room3;
public bool Room4;
public bool Room5;

private void btnRoom1_Click(object sender, EventArgs e)
    {
        this.Hide();

        //This displays Form2
        Form2 RoomTemplate = new Form2();
        RoomTemplate.Show();

        Room1 = true;
        Room2 = false;
        Room3 = false;
        Room4 = false;
        Room5 = false;

    }

Form2 code:

public Form3()
    {
        InitializeComponent();
        Form2 Rooms = new Form2();

        if (Rooms.Room1 == true)
        {
            lblTitle.Text = "Living Room";
        }

        if (Rooms.Room2 == true)
        {
            lblTitle.Text = "Dining Room";
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:49:46+00:00Added an answer on June 6, 2026 at 10:49 pm

    This is one way to do it:

    public bool Room1;
    public bool Room2;
    public bool Room3;
    public bool Room4;
    public bool Room5;
    private void btnRoom1_Click(object sender, EventArgs e)
    {
        this.Hide();
    
        Room1 = true;
        Room2 = false;
        Room3 = false;
        Room4 = false;
        Room5 = false;
    
        //This displays Form2
        Form2 RoomTemplate = new Form2(this);
        RoomTemplate.Show();
    }
    
    public class Form2()
    {
        public Form2(Form1 form1)
        {
            InitializeComponent();
            if(form1.Room1 == true)
            {
                lblTitle.Text="Living Room";
            }
            else if(form1.Room2==true)
            {
                //
            }
            //
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have these five buttons that I want to be always present in
I have a set of five functions, that could be called one of five
I have a tab bar controller with five buttons. That controller has a tab
I have five activities/screens that I would like to be able to swipe between,
I have five tables that are fairly similar in structure but different enough that
I have below five Integer variables and during the program, they are assigned some
I have five fields for number input, and each of these fields must be
I have an unusual need. I have five input checkboxes that look like this:
I am developing one application and in which i have to display a five
I have grid view which contains five radio buttons per row. Out of these

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.