出学C#高手帮忙
来源:百度知道 编辑:UC知道 时间:2024/06/06 17:16:33
请高手帮写个完整的码,我学习学习.谢谢!
我想不点BOTTON就出结果,能做到吗
private void button1_Click(object sender, EventArgs e)
{
if ((this.textBox1.Text == "电脑") && (int.Parse(this.textBox2.Text) <= 10))
{
this.textBox3.Text = "30";
}
else if ((this.textBox1.Text == "电脑") && (int.Parse(this.textBox2.Text) > 10))
{
this.textBox3.Text = Convert.ToString((int.Parse(this.textBox2.Text) + 20));
}
}
晕,不知道,你做这个有什么用的。。不用Button就这样写
private void textBox2_TextChanged(object sender, EventArgs e)
{
if ((this.textBox1.Text == "电脑") && (int.Parse(this.textBox2.Text) <= 10))
{
this.textBox3.Text = "30";
}
else if ((this.textBox1.Text == "电脑") && (int.Parse(this.textBox2.Text) > 10))
{
this.textBox3.Text = Convert.ToString((int.Parse(this.textBox2.Text) + 20));
}
}
string a=textbox1.text;
int b=int.parse(textbox2