Reputation: 9
Am receiving this error Cannot implicitly convert type 'double' to 'string'....i used the following code, what might be the problem? is there an easier way than mine?
QtyTextBox.Text = SimulateVal.Val(TextBox2.Text) + SimulateVal.Val(QtyTextBox.Text);
Upvotes: 1
Views: 879
Reputation: 1832
I'm assuming that SimulateVal.Val(string)
returns a double, as in a numeric type, and you want to output the sum of the two numbers as text.
QtyTextBox.Text = (SimulateVal.Val(TextBox2.Text) + SimulateVal.Val(QtyTextBox.Text)).ToString();
Upvotes: 0
Reputation: 1952
Why not:
QtyTextBox.Text = (SimulateVal.Val(TextBox2.Text) + SimulateVal.Val(QtyTextBox.Text)).ToString();
Upvotes: 0