Page 1 of 1

larger then amount?

Posted: Wed Dec 19, 2012 4:38 pm
by Dummy1912
Hello,

seems i got stuck
how do i do this part
Code: Select all
'THESE ARE JUST EXAMPLE's HOW I GET IT IN REAL CODE
dim a1 as double = -150
dim a2 as double = 100

if a2 > a1 then
msgbox("a2 can't be larger then a1")
else
msgbox("ok")
end if

it seems when i calculated it i get a message thats says that a2 is larger then a1
and like you see its not

any idea how i can calculated it so i don't get this message
i think he can't calculate it because it contains a -

any one?

Image
Image
thanks

Re: larger then amount?

Posted: Wed Dec 19, 2012 5:24 pm
by clanc789
Why do you declare them as double? Think you have to declare them as integer?

Re: larger then amount?

Posted: Wed Dec 19, 2012 5:26 pm
by Dummy1912
hi clanc789
yea but its not a integer these are amounts :)

Re: larger then amount?

Posted: Wed Dec 19, 2012 7:22 pm
by clanc789
Lemme think some time on it. I hope I can help you :D

Re: larger then amount?

Posted: Wed Dec 19, 2012 7:43 pm
by visualtech
use a float it use a string and then use Int32.Parse to change it to an integer

Re: larger then amount?

Posted: Wed Dec 19, 2012 8:06 pm
by Filip
Try declaring doubles like this:
Code: Select all
dim a1 as double = 5.125

Re: larger then amount?

Posted: Wed Dec 19, 2012 9:35 pm
by Dummy1912
this will set the amount to 0
Code: Select all
If (amount1 + amount2) > 0 Then
problem solved :)
thanks guys. loove;