Results 1 to 3 of 3

Thread: Did adding, subtracting, etc.. change in asp.net?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Minnesota
    Posts
    830

    Did adding, subtracting, etc.. change in asp.net?

    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.

    Code:
    lblMLSubTotal.Text = CDbl(txtMaterialAmt.Text) + CDbl(txtLaborAmt.Text)
    lblExciseAmt.Text = CDbl(lblMLSubTotal.Text) * CDbl(txtExciseAmt.Text)
    Thanks in advance.
    Last edited by lleemon; May 19th, 2004 at 07:51 AM.

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    VB Code:
    1. lblTotal.Text = Double.Parse(txtNum1.Text) + Double.Parse(txtNum2.Text)
    2. lblTotal.Text = Double.Parse(txtNum1.Text) * Double.Parse(txtNum2.Text)
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Minnesota
    Posts
    830
    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?

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width