#### Howdy, Stranger!

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

#### Categories

Welcome to the new platform of Programmers 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 it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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?
· ·

• 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)
· ·
• 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.
· ·
• 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)
· ·