public partial class Form1: Form {
// Define a few variables
int InputInteger;
int HoldInteger;
int OutputInteger;
public Form1() {
InitializeComponent();
}
private void exitBtn_Click(object sender, EventArgs e) {
//Used to close the form when exit is clicked
this.Close();
}
private void clearBtn_Click(object sender, EventArgs e) {
//this will deselect all of the radio buttons, along with clearing the
// textboxes with input and output information.
depositBtn.Checked = false;
checksBtn.Checked = false;
serviceBtn.Checked = false;
inputTxt.Clear();
outputTxt.Clear();
}
private void calculateBtn_Click(object sender, EventArgs e) {
// Calculate button actions
try {
InputInteger = Convert.ToInt32(inputTxt.Text);
// For each radio button checked gives an action to the calculate button
if (depositBtn.Checked == true); {
OutputInteger = (InputInteger + HoldInteger);
outputTxt.Text = OutputInteger.ToString();
} else if (checksBtn.Checked == true); {
if (InputInteger > OutputInteger); {
OutputInteger = (HoldInteger - 10);
outputTxt.Text = OutputInteger.ToString();
MessageBox.Show("Insufficient Funds");
if (HoldInteger < 0); {
MessageBox.Show("Negative account balance");
}
} else if (InputInteger <= HoldInteger); {
OutputInteger = (InputInteger - HoldInteger);
outputTxt.Text = OutputInteger.ToString();
}
} else if (serviceBtn.Checked); {
if (InputInteger > OutputInteger); {
OutputInteger = (HoldInteger - 10);
outputTxt.Text = OutputInteger.ToString();
MessageBox.Show("Insufficient Funds");
if (HoldInteger < 0); {
MessageBox.Show("Negative account balance");
}
} else if (InputInteger <= HoldInteger); {
OutputInteger = (InputInteger - HoldInteger);
outputTxt.Text = OutputInteger.ToString();
}
}
} catch {
}
}
private void outputTxt_TextChanged(object sender, EventArgs e) {
}
}
}
我沒有在我的只讀outputTxt文本框中獲取任何文本。任何幫助表示讚賞。我需要在計算按鈕的每次單擊事件後顯示outputTxt。我已經使用HoldInteger來保存輸出整數的中間計算,它應該是每次選擇單選按鈕的最終輸出。 My formC#程序不顯示輸出值
神聖的廢話我覺得自己像一個白癡,不應該試圖寫一個分心的程序。感謝一堆dotnetom! –