Convert to an integer and get a sum of two numbers

advertisements

I would like to get the sum of two numbers that are in string format such as below, but it does not work. any ideas? costDay2.Text and costDay3.Text are number values in a textbox

Dim Days23 As Decimal

Days23 = (Convert.ToDecimal(costDay2.Text) + Convert.ToDecimal(costDay3.Text))

The result I get is 0.00, but the value of costDay2.Text = 150.00 and costDay3 = 200.00, so the result should be 350.00


This works for me in VS 2012. 2 text boxes, costDay2, costDay3 and one command button. At run time I input the values 2.01 and 2.50 into each text boxr espectively. I click Button1 and get a result of 4.51 as expected

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Day2, Day3, Day23 As Double

Day2 = costDay2.Text
Day3 = costDay3.Text
Day23 = Day2 + Day3
MsgBox(Day23)
End Sub