private void LH()
{
int length = int.Parse(textBox1.Text);
int height = int.Parse(textBox2.Text);
float outcome;
outcome = (float)length / height;
textBox3.Text = outcome.ToString();
}
private void LS()
{
int length = int.Parse(textBox1.Text);
int slope = int.Parse(textBox3.Text);
float outcome;
outcome = (float)length / slope;
textBox2.Text = outcome.ToString();
}
private void HS()
{
int height = int.Parse(textBox2.Text);
int slope = int.Parse(textBox3.Text);
float outcome;
outcome = (float)slope*height;
textBox1.Text = outcome.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1 && textBox2)
{
LH();
}
else if (textBox1 && textBox3)
{
LS();
}
else if(textBox2 && textBox3)
{
HS();
}
}
我想测试是否在文本框中输入了值以通过将 IF 块与文本框的条件一起评估 req 函数。但是当我尝试这个时它说文本框值不能转换为布尔值......所以告诉我任何人如何测试它并转换为布尔值