Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**rabid****Guest**

hey ya,

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

Cheers

Rabid Lemming

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,534

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".

Try this:

MinDeposit = cdbl(txtPriceOfProperty.Text) * 0.05

if (Deposit >= MinDeposit) then

...

end if

Let's know how you get on

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

**rabid****Guest**

hi,

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

Else

CheckDepostit = False

End If

Thank you for your help

Cheers

Rabid Lemming

**ShivamS****Member**- Registered: 2011-02-07
- Posts: 3,467

What is that?

Offline

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'

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**ShivamS****Member**- Registered: 2011-02-07
- Posts: 3,467

No, there was another post by a guest today on this thread which was composed of weird symbols only.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,251

That got deleted, he is a vandal.

**In mathematics, you don't understand things. You just get used to them.I have the result, but I do not yet know how to get it.All physicists, and a good many quite respectable mathematicians are contemptuous about proof.**

Offline

Pages: **1**