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! –