我正在試圖用一個計時器來創建一個數學遊戲,該計時器可以計算特定時間內的正確問題的數量。如果答案正確,現在我試圖增加每個按鈕點擊的int
值。每個按鈕單擊增加數C#Desktop
但只遞增一次,有時不遞增:
private void button1_Click(object sender, EventArgs e)
{
int x = Randomnumber.Next(12);
int z = Randomnumber.Next(12);
int s = x * z;
int correct = 0;
//int cv = +correct;
textBox2.Text = x.ToString();
textBox3.Text = z.ToString();
if (s == Convert.ToInt32(textBox4.Text))
{
correct += 1;
numbercorrect.Text = correct.ToString();
}
}