Condition with Click

Asked

Viewed 41 times

-1

I’m doing a quiz with 4 answers/buttons,and with items, which are only activated if they are clicked,one of them works like this:If you want to use it you have to activate it before you answer,the person responds, if you answer wrong this item will run and will do a Refresh in the form, if the answer is right, the item does nothing. My problem is that I am unable to make the condition for the buttons, these button.click conditions do not work.

 private void gunaCirclePictureBox2_Click(object sender, EventArgs e) //Evento do tal item 
    {            
        if (button1.Click || button2.Click|| button3.Click) // Esses são os botões correspondentes as respostas erradas,ou seja só se um desses botões forem clicados é que fará o refresh do form
        {
            this.Refresh();
        }           
    }

1 answer

0


Basically your code is saying that if gunaCirclePictureBox2 is clicked it will run this if, which is not what you want. From the way you described it would be better to create a click event for each wrong button and it call the method Refresh. Creating a method GameOver you could call it whenever an answer is wrong, just by assigning to the button click later.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.