Oyetoke Toby

Oyetoke Toby

  • NA
  • 116
  • 316.3k

How to know when a button is clicked in C#

Jul 29 2016 3:14 PM
Pls I need your help in some cases about button in C#. How can I know when a particular button is clicked. I want to use the if condition statement to write the event. So I want it to do something when particular button is clicked. I want to put all the code inside one function or class then I can call it anytime. For example
 
  1. private void showPanel()  
  2. {  
  3.  if (dashPanelButton.Clicked == true)  
  4. {  
  5. dashPanel.Visible = true;  
  6. }  
  7. else if(studInfoBtn.Clicked == true)  
  8. {  
  9. studInfoPanel.Visible = true;  
  10. }  
  11. else  
  12. {  
  13. homePanel.Visible = true; 
  14. }  
  15.   
  16. }  
 Note the above code is just an assumption not really a working code. Just using it to explain myself

Answers (2)