Home > Net >  Novice consult CSharp counting problem
Novice consult CSharp counting problem

Time:11-22

I have a button1_Click button event is used to collect data into Excel spreadsheet, every trigger a count, the count value in the From the form of text, text expression, how to write the count software closed or button2 trigger when reset counts, hope expert advice, thank you

CodePudding user response:

Need a file (or database) to store count,

CodePudding user response:

Static int counter=0,

CodePudding user response:

Don't know if I understand right
Can't you directly define a global variable

Int number=0;//each open software is 0

Private void button1_Click ()
{
//your existing function

//if the previous function run successfully, count + 1
The if ()
{number++; }

}

//2 reset button count
Private void button2_Click ()
{
Number=0;
}

CodePudding user response:

Thank you for your great masters of the experiments can be specified
  •  Tags:  
  • C#
  • Related