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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:07:47+00:00 2026-06-14T16:07:47+00:00

Quit Button Click Event. `void buttn2_Click(object sender, EventArgs e) //QUIT BUTTON CLICK EVENT. {

  • 0

Quit Button Click Event.

`void buttn2_Click(object sender, EventArgs e) //QUIT BUTTON CLICK EVENT. 
    {
       if (MessageBox.Show("LEAVE CURRENT GAME?", "QUIT CONFIRMATION", MessageBoxButtons.YesNo) == DialogResult.Yes)
        {
            this.Controls.Remove(buttn); .. PLAY AGAIN BUTTON.
            this.Controls.Remove(buttn2);
            for (int i = 0; i <= gencount; i++)
            {
               this.Controls.Remove(panel[i]);
               this.Controls.Remove(label200[i]);
               this.Controls.Remove(label100[i]);
               this.Controls.Remove(Tbox[i]);
            }
               this.Controls.Remove(AttemptsRem);
               this.Controls.Remove(AttemptNum);
               this.Controls.Remove(TimeRem);
               this.Controls.Remove(Min);
               this.Controls.Remove(Sec);
               this.Controls.Remove(misc);
               this.ReftoForm2.Show(); To go back to the starting form 
        }
        else
            buttn.Focus();
    }

Form1 activate Event.

 private void Form1_Activated(object sender, EventArgs e)
    {
        if (ui_formCowsAndBulls.rdbSinglePlayer.Checked == true)//Static variable
        {

            //GetAllTheWords(); .. Am still working on getting a the 4 letter words
            //GetDistinctElements(); .. randomly out of a list.
            textBox1.PasswordChar = '*';
            textBox1.Focus();
            foreach (string val in distinctWords)
            {
                if (val == "ABLE") .. For single player,the guess word is ABLE.
                    textBox1.Text = val;
            }
        }
        else
        {
            textBox1.Text = string.Empty;
            textBox1.Enabled = true;
            textBox1.Focus();
        }
        //textBox1.Focus();
    }

PLAY AGAIN CLICK EVENT

 private void buttn_Click(object sender, EventArgs e) //PLAY AGAIN CLICK EVENT.
    {
        for (int i = 0; i <= gencount; i++)
          {
            this.Controls.Remove(panel[i]);
            this.Controls.Remove(label200[i]);
            this.Controls.Remove(label100[i]);
            this.Controls.Remove(Tbox[i]);
          }

            this.Controls.Remove(AttemptsRem);
            this.Controls.Remove(AttemptNum);
            textBox1.Text = string.Empty;
            textBox1.Enabled = true;
            textBox1.Focus();
            incrpanel = 0; gencount = 0; count = 10;
            this.Controls.Remove(TimeRem);
            this.Controls.Remove(Min);
            this.Controls.Remove(Sec);
            this.Controls.Remove(misc);
            this.textBox1.PasswordChar = '*';
            this.Controls.Remove(buttn);
            this.Controls.Remove(buttn2);
    }

My question is I dont come out of the message boxes when I click message box button NO.I come out of the message box the first time I play the game,But If i play the game a second time,it takes me two clicks to come out of the Message box.If I play the game a third time,it takes me 3 clicks on either the Yes or NO button to come out of the Message Box.I hope you folks can help me.I had posted the same question before but without the code.Hope the code helps.

  • 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-14T16:07:48+00:00Added an answer on June 14, 2026 at 4:07 pm

    I think you may be subscribing to the Click-event:

    button1.Click += new EventHandler(buttn2_Click);
    

    in a place in the code where it’s called more than once, so when the button is clicked the MessageBox will be shown, and when the buttn2_Click event handler (-your code that you posted) is finished – it will run again, showing another MessageBox, for as many times as the subscription (the “…+=…” above) was done.

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

Sidebar

Related Questions

I want to quit application through button click. the code for button click is
I'm calling the following method from a button click event to export a datatable
I'd like a MessageBox to display when I click a button on my simple
In my application I have a quit button, on clicking of which the session
I need to force quit my app when I pressed the Answer button in
I am using finish() to close current activity before quit application in Android. However,
I've heard that pressing the back button will essentially cause the current Activity to
I have a scenario where the user can either click on the back button
I have a Game class that has a -(void) play method which will be
I have a JavaScript event listener function that waits for a user to click

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.