2008-12-29 45 views
0

我正在用C#構建一個計算器。 我不知道什麼最好的辦法是讓它每次按下按鈕時增加一個數組中的數字。這是我目前的按鈕事件處理函數方法:每按一次按鈕增加數組值?

//Assign button '2' to 2 with array address of 1 
    private void num2_Click(object sender, EventArgs e) 
    { 
     numbers[1] = 2; 
     lblUpdate(1); 
    } 

我想它所以每次按下此按鈕,數字[1]被增加2眼下,它只是被設置爲2,不管時間按下按鈕的次數。

非常感謝!

回答

3
numbers[1] += 2; 
3

numbers [1] + = 2;

這應該做的伎倆。

3

numbers [1] + = 2;

相關問題