I really hate maths lol, ok heres my problem
I have a variable know as PriceOfProperty
I have another variable known as Deposit
Both variables can be any number as they are set by a user input
I need to ensure that what ever the PriceOfProperty the Deposit is at least 5% of that value
It has to be in the format of an if statement like so:
If the Deposit value is 5 % of PriceOfProperty value then true
Only its actual syntax is in this format:
If (txtPriceOfProperty.Text / 100) * 5 > . Then
Only that sum doesnt work as that now how you work it out
Any help would be appreciated
Hi Rabid, is the language Visual Basic?
Perhaps the problem is that the value is text, not numeric. Try converting it first. In VB you could use CDbl().
Also try showing the numbers before and after the calculation (debug.print or msgbox or whatver works to show them on the screen) to see what is going on.
It is also possible that when dividing by 100 it is thinking "this is a whole number, so the answer should be a whole number".
MinDeposit = cdbl(txtPriceOfProperty.Text) * 0.05
if (Deposit >= MinDeposit) then
Let's know how you get on
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Cheers that helped a lot I got it working using:
Dim var10 As Decimal
Dim var11 As Decimal
'Get 5% of the house price as a decimal number
var10 = (txtPriceOfProperty.Text / 100) * 5
'Get the deposit as a decimal
var11 = txtDeposit.Text
'Check the depositis grater then the asking amount
If (var11 >= var10) Then
CheckDepostit = True
CheckDepostit = False
Thank you for your help
What is that?
Visual Basic Program
'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember
No, there was another post by a guest today on this thread which was composed of weird symbols only.