創建一個包含4個文本框的簡單表單。兩個用於輸入,兩個用於輸出。用戶爲文本框1和2提供輸入,並將副本複製到第3個和第4個文本框中。現在,當點擊按鈕並且用戶在文本1中輸入第二個數量時,我想要在text3中添加總數。For Statement not working C#
public void btnSubmit_Click(object sender, System.Windows.RoutedEventArgs e)
{
int BayOne;
int BayTwo;
int BayOneTotal;
int BayTwoTotal;
BayOne = Convert.ToInt32(txtBayOne.Text);
BayTwo = Convert.ToInt32(txtBayTwo.Text);
for (int i = BayOne; i < 25000; i++)
{
BayOneTotal = i + i;
}
txtBayOneTotal.Text= BayOne.ToString();
txtBayTwoTotal.Text= BayTwo.ToString();
}
輸入在BayOne中(結果在BayOneTotal中重複)等。結果沒有正確添加。它只是重新發布第二次公佈的價值。
其中是無限循環? – evilone
非常不清楚。發佈預期值與實際值的準確值。\ –
對不起。 A聲明,而不是LOOP。 – riceformvp