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 8882707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:38:45+00:00 2026-06-14T20:38:45+00:00

I am making a random character generator, i have 2 forms, form1 and form2,

  • 0

I am making a random character generator, i have 2 forms, form1 and form2, on my form2 i have the checkboxes there, so if the user checked checkbox1, on my form1 it will only display 1 character, now if the user check all 5 checkboxes, my form1 will generate 5 characters. i have a button on form1 that will trigger an event on generating random characters.

characters: ‘+’,’-‘,’*’,’/’,’%’

how will my code be? I am using
WINDOWS FORMS APPLICATION.

pics here:
form1: http://i49.tinypic.com/30bzos8.png
form2: http://i50.tinypic.com/k00ndt.png

        char[] select = new char[] { '+' , '-' , '*' , '/', '%' };
        var rand = new Random();
        char num = select[rand.Next(5)];
  • 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-14T20:38:46+00:00Added an answer on June 14, 2026 at 8:38 pm

    This situations are always interesting since we do not know what you have or not have covered in class. So as per my comment above above in which it appears you gave conflicting answers I will assume that Form2 is being created in the Constructor of Form1 Like so.
    You will need some sort of method to determine what Combobox’s are checked, I just XOR’d binary values, and as I said in my Comment I would start Form2 with a ShowDialog and look at the return value to determine wether to exit or continue. I will give you a quick and dirty example, it is up to you to flesh it out. If this is not the case you will need to post a little more Code

    Form1

    public partial class Form1 : Form
    {
        char[] operators;
    
        public Form1()
        {
            InitializeComponent();
            Form2 frm2 = new Form2();
            if (frm2.ShowDialog() == DialogResult.OK) //Check for DialogResult Here
            {
                operators = CreateArray(frm2.GetOperators); // Get ComboBox Values from Form2 and Process them
                frm2.Close();                  // Close Form2
            }
            else
                Application.Exit();           // If DialogResult is not OK then exit Form
        }
    
        private char[] CreateArray( int value)
        {
            string num = "";
            if ((value & 1) == 1)
                num += "+";
            if ((value & 2) == 2)
                num += "-";
            if ((value & 4) == 4)
                num += "*";
            if ((value & 8) == 8)
                num += "/";
            if ((value & 16) == 16)
                num += "%";
    
            return num.ToCharArray();
        }
    }
    

    Form2

    public partial class Form2 : Form
    {
        int operators;
        public Form2()
        {
            InitializeComponent();
        }
    
        private void checkBox_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox cb = (CheckBox)sender;
            //Method that I used for determining CheckBox State. You can use a boolean array or an Enumeration ....
            if (cb.Text == "Addition")
                operators = operators ^ 1;
            else if (cb.Text == "Subtraction")
                operators = operators ^ 2;
            else if (cb.Text == "Multiplication")
                operators = operators ^ 4;
            else if (cb.Text == "Division")
                operators = operators ^ 8;
            else if (cb.Text == "Modulus")
                operators = operators ^ 16;
    
        }
        public  int GetOperators       //Property for return value to Form1
        {
            get { return operators; }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a password generator that generates a random number, then I have
I'm still learning the basics and I'm making a Random Character Generator that creates
Hey guys I am making a 2D game and I have generating a random
I'm making an animation in Processing. I have some random points moving randomly and
Hello I am making an app that requires a random page generator so I
I have been experimenting on making a random map for a top down RPG
I am making a program in C++ using Xcode that will generate random strings
I'm trying my hand at making a character generator (python 2.7) for a pen
I am making a site that each account will have an ID. But, I
I'm thinking about making a math program. It will ask a random question from

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.