How do I assign multiple buttons to an If-Statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I assign multiple buttons to an If-Statement

I'm currently working on a new project for beginners in c#. I've got a reset button, which resets all buttons pressed before, however I don't want my user to be able to press it until a specified amount of other buttons have been pressed. How do I do that?

2nd Oct 2018, 9:52 AM
Samuel
Samuel - avatar
4 Answers
0
Use a counter that count how many times the other buttons are pressed then when you reached some value, activate the reset button (i cannot help on code because i dont know C#)
2nd Oct 2018, 10:20 AM
KrOW
KrOW - avatar
0
disable the button until your condition is satisfied then enable it button1.enable = true
2nd Oct 2018, 3:58 PM
Asgar Aziz
Asgar Aziz - avatar
0
disable the button until your condition is satisfied then enable it button1.enable = true The thing is, I don't know how to put the condition.
2nd Oct 2018, 4:01 PM
Samuel
Samuel - avatar
0
the thing is I am not familiar with c# but I can guide you.you can use the buttonclick event handler to check how many buttons have been pressed
2nd Oct 2018, 4:10 PM
Asgar Aziz
Asgar Aziz - avatar