Lucio Silveira

Lucio Silveira

  • NA
  • 3
  • 1.1k

Help in starting with visual #C

Apr 24 2014 10:24 AM
Hi everyone. I'm just starting to learn about c#. I'm a C programmer to microcontrollers but I don't know anything about oriented object. I'm trying to develop a windows form with only one buttom. Everytime the buttom is pressed it shows in a message box how many times the buttom was pressed. The problem is that i have to declare the variable that will hold the number of times the buttom was pressed locally into the "buttom click"event  and initialize that with zero. Then everytime the buttom is pressed and the event is serviced I would increment this variable by 1 and show in the message box. The problem is that the variable is initialized again and  goes back to zero. I use to do this by using global variables that is a common practice in procedural programming. But it seems that there's no such thing in oriented object programming. Does anyone may help me find a solution ?
 
 Best Regards 
 
Lucio
 

Answers (3)