PDA

Click to See Complete Forum and Search --> : Did adding, subtracting, etc.. change in asp.net?


lleemon
May 19th, 2004, 07:13 AM
Using asp.net (vb) and have a label and textbox.

In vb6 we could do a lblExciseAmt.Text + txtLaborAmt.Text and result in the sum of the two numbers provided in each control.

If I have a value of 1 and 0 respectively I get a result of 10 in asp.net. Is there a new way of doing calculations? Do I have to put into variables first?

Well I got the first issue resolved by adding the CDbl. Now I get an the following error 'Input string was not in a correct format' pointing to the 2nd line.


lblMLSubTotal.Text = CDbl(txtMaterialAmt.Text) + CDbl(txtLaborAmt.Text)
lblExciseAmt.Text = CDbl(lblMLSubTotal.Text) * CDbl(txtExciseAmt.Text)


Thanks in advance.

Memnoch1207
May 19th, 2004, 08:28 AM
lblTotal.Text = Double.Parse(txtNum1.Text) + Double.Parse(txtNum2.Text)
lblTotal.Text = Double.Parse(txtNum1.Text) * Double.Parse(txtNum2.Text)

lleemon
May 19th, 2004, 10:25 AM
Thanks for the quick response. I have applied this change and am still getting the:
Exception Details: System.FormatException: Input string was not in a correct format

source error pointing to the second line. Is it possible since I am doing this with a label?


lblMLSubTotal.Text = Double.Parse(txtMaterialAmt.Text) + Double.Parse(txtLaborAmt.Text)
lblExciseAmt.Text = Double.Parse(lblMLSubTotal.Text) * Double.Parse(txtExciseAmt.Text)