Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i have a new c# windows form application and i have 5 buttons on it but i made button5 hidden and not visible until the right button click combination is achieved is there a way that i can have like a passcode where like button1 then button4 then button2 then it unlocks button5

something like this maybe -

button1_clicked + button4_clicked + button2_clicked = button5.show();

and they need to be in correct click order for button5 to become visible ????

im new so not sure the right way to ask the question but this makes sense to me can someone please give me help
Posted

1 solution

You could use an integer variable for this (a form class member), say
C#
int current_state = 0;

Then:
  • in button1 click event handler set current_state=1.
  • button4 click event handler sets current_state=2 only if current_state==1, otherwise it sets current_state=0.
  • button2 click event handler calls button5.show() only if current_state==2 (and sets anyway current_state=0).
 
Share this answer
 
Comments
Ashi0891 14-Aug-14 2:05am    
good and easy :)
CPallini 14-Aug-14 4:04am    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900