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

  • Home
  • SEARCH
  • 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 9071597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:57:14+00:00 2026-06-16T17:57:14+00:00

I am currently taking a beginner’s class in c#. We missed 2 consecutive classes

  • 0

I am currently taking a beginner’s class in c#. We missed 2 consecutive classes because the teacher couldn’t be there. So we didn’t really see what we needed to do this. He said to just go see on MSDN, but that is usually way too complicated for me. So here is my problem:

I have to create a “Simon Says” program. Here is my current code (sorry for the French variables):

public partial class Form1 : Form
{
    const byte LIMITE = 255;
    const byte LIMITEBOUTON = 5;
    byte[] _abyBouton = new byte[LIMITE];
    Random _rand = new Random();


    public Form1()
    {
        InitializeComponent();
    }

    //Blinks the Button. Works correctly.
    void AnimerBouton(Button btnBouton, Color Cocoleur)
    {
        btnBouton.BackColor = Color.Black;
        btnBouton.ForeColor = Color.White;
        Update();
        System.Threading.Thread.Sleep(500); // C'est inscrit en miliseconde
        btnBouton.BackColor = Cocoleur;
        btnBouton.ForeColor = Color.Black;
        Update();
        System.Threading.Thread.Sleep(500); // C'est inscrit en miliseconde
    }

    private void btnDémarrer_Click(object sender, EventArgs e)
    {
        //Creates an array with the 255 eventual moves.
        for (byte byIndex = 0; byIndex <= LIMITE - 1; byIndex++)
        {
            _abyBouton[byIndex] = (byte)_rand.Next(1, LIMITEBOUTON);
        }

        for (byte byIndex = 0; byIndex <= LIMITE - 1; byIndex++)
        {
            //Takes care of the current progress in the game.
            for (byte byIndex2 = 0; byIndex2 <= byIndex; byIndex2++)
            {
                switch (_abyBouton[byIndex2])
                {
                    case 1:
                        {
                            AnimerBouton(btn1, Color.Green);
                        }
                        break;
                    case 2:
                        {
                            AnimerBouton(btn2, Color.Red);
                        }
                        break;
                    case 3:
                        {
                            AnimerBouton(btn3, Color.Yellow);
                        }
                        break;
                    case 4:
                        {
                            AnimerBouton(btn4, Color.Cyan);
                        }
                        break;
                }
                //Wait to see if the click is correct. No idea how to do this.
            }
        }  
    }
}

So I have to wait for the user to click a button and see if it is the correct one. I looked around and it was talking about events, but I couldn’t grasp what I needed to do. I would appreciate some help on how to do this.

Thanks!

  • 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-16T17:57:15+00:00Added an answer on June 16, 2026 at 5:57 pm

    In the designer, on the properties window, click the lightning bolt icon. You will get a list of events for the selected control. Make sure the btnBouton control is selected, and find the Click event in the list. You should see btnDemarrer_Click in the drop down list. Select it. Now when the button is clicked, it should call your btnDemarrer_Click handler.

    When you have not already written a handler, you can double-click the event in the list, and it will generate the method skeleton for you automatically. You can also double-click the control itself to generate the default event handler for that control. (In the case of buttons, I think the default event is the click event.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently taking a math class in College called Scientific Computing and the professor
I'm currently taking a web development class and looking to go beyond the scope
In the data structures class that I am currently taking, we have been tasked
I'm very new to Unix, and currently taking a class learning the basics of
I'm currently taking an algorithms class. I'm testing a lot of them out in
I'm currently taking a class where we are learning about synchronization of threads. The
I'm a novice to c++ programming and currently taking a class as an introduction
I am currently taking a class which is incorporating a topic I have not
I'm currently taking a class on programming the iPhone, and I am struggling with
I am currently taking a parallel programming class and our first programming exercise was

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.