我正在制作一个计算3D打印成本的程序。我提出了这个问题。
private void button1_Click(object sender, EventArgs e)
{
double getal1 = Int32.Parse(textBox1.Text);
double getal2 = Int32.Parse(textBox2.Text);
double volume = 0.002405281875;
double volume1 = 0;
int dichtheidpla = Int32.Parse("1,24");
if (comboBox1.Text == "PLA")
{
//volume berekenen
volume1 = volume * getal1;
V.Text = volume1.ToString("N2");
//gewicht berekenen
int volumeberekend = Convert.ToInt32(volume1);
gewicht1.Text = volumeberekend * dichtheidpla;
}
else if (comboBox1.Text == "ABS")
{
}
}
}
当我想计算gewicht1时,错误显示我:无法隐式转换类型' int'到'字符串'。 & volumebereke * dichtheidpla'下面有一条红线。
答案 0 :(得分:1)
Me.Close.()
是字符串类型,表达式的结果将是Me.Close()
。因此,您只需将结果转换为gewicht1.Text
。
int