Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

adding doubles

satsocsatsoc Posts: 19Member
hello ppl
i have to calculate a*b/a+b,dim b as double,a=var(Text1.Text),but the result is wrong.i think that something is not right when adding var() with double.Can anybody help?

Comments

  • slicer69slicer69 Posts: 272Member
    : hello ppl
    : i have to calculate a*b/a+b,dim b as double,a=var(Text1.Text),but the result is wrong.i think that something is not right when adding var() with double.Can anybody help?
    :

    dim b as double
    dim c as double

    c = double(Text1.text)
    result = (c * b) / (c + b)
  • satsocsatsoc Posts: 19Member
    : : hello ppl
    : : i have to calculate a*b/a+b,dim b as double,a=var(Text1.Text),but the result is wrong.i think that something is not right when adding var() with double.Can anybody help?
    : :
    :
    : dim b as double
    : dim c as double
    :
    : c = double(Text1.text)
    : result = (c * b) / (c + b)
    :
    man i tried that double(Text1.Text) but it doesn't seem to be recognised by the compiler.
  • hobbyhobby Posts: 84Member
    : : : hello ppl
    : : : i have to calculate a*b/a+b,dim b as double,a=var(Text1.Text),but the result is wrong.i think that something is not right when adding var() with double.Can anybody help?
    : : :
    : :
    : : dim b as double
    : : dim c as double
    : :
    : : c = double(Text1.text)
    : : result = (c * b) / (c + b)
    : :
    : man i tried that double(Text1.Text) but it doesn't seem to be recognised by the compiler.
    :

    Try:

    c = CDbl(Val(Text1.text))

    or

    c = CDbl(Text1.text)

    The Val() function just converts text1.text to a number (or tries to at least), but it may not be necessary if you only have numbers (i.e. Val could convert A1 to 1)
Sign In or Register to comment.