我无法乘以两个文本框的值。
private void button1_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textBox1.Text) && !string.IsNullOrEmpty(textBox2.Text))
{
textBox3.Text = (Convert.ToInt32(textBox1.Text) * Convert.ToInt32(textBox2.Text)).ToString();
}
}
private void button2_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textBox3.Text) && !string.IsNullOrEmpty(textBox4.Text))
{
textBox5.Text = (Convert.ToInt32(textBox3.Text) + Convert.ToInt32(textBox4.Text)).ToString();
}
}
答案 0 :(得分:0)
这是指向正确方向的东西......
private void button1_Click(object sender, EventArgs e)
{
float tbox1 = float.Parse(textBox1.Text);
float tbox2 = float.Parse(textBox2.Text);
float tbox12;
if (textBox1 != null && textBox2 != null)
{
tbox12 = tbox1 + tbox2;
textBox3.Text = tbox12.ToString();
}
}
private void button2_Click(object sender, EventArgs e)
{
float tbox3 = float.Parse(textBox3.Text);
float tbox4 = float.Parse(textBox4.Text);
float tbox34;
if (textBox3 != null && textBox4 != null)
{
tbox34 = tbox3 + tbox4;
textBox5.Text = tbox34.ToString();
}
}