c# - Cannot implicitly convert type 'int' to 'string' on 2 intergers -
i making program calculating cost of 3d printing stuff. came on question.
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") { } } }
when want calculate gewicht1 error shows me: cannot implicitly convert type 'int' 'string'. there red line under 'volumeberekend * dichtheidpla'.
gewicht1.text
string type, , result of expression int
. have convert result string
.
gewicht1.text = (volumeberekend * dichtheidpla).tostring();
Comments
Post a Comment