Does anyone know VB!?!?

View previous topic View next topic Go down

Does anyone know VB!?!?

Post by BunBun<3 on Sun Sep 26, 2010 1:23 am

OK i need some help lol i can't figure out why this code won't come out right i have checked everything!!!!
Code:
<script type="text/vbscript">
<!--
option explicit
dim priceofwatermelons, priceofcantaloupes, priceofhoneydewmelons, numberofwatermelons
dim numberofcantaloupes, numberofhoneydewmelons, costofwatermelons, costofcantaloupes
dim costofhoneydewmelons, totalnumberofmelons, totalprice
dim add1, add2
'assignments
priceofwatermelons = 5
priceofcantaloupes = 8
priceofhoneydewmelons = 10
'input
numberofwatermelons = inputbox ("Number of Watermelons?")
numberofcantaloupes = inputbox ("Number of Cantaloupes?")
numberofhoneydewmelons = inputbox ("Number of Honeydew Melons?")
'calculations
costofwatermelons = numberofwatermelons * priceofwatermelons
costofcantaloupes = priceofcantaloupes * numberofcantaloupes
costofhoneydewmelons = priceofhoneydewmelons * numberofhoneydewmelons
totalnumberofmelons = numberofwatermelons + numberofcantaloupes + numberofhoneydewmelons
totalprice = costofwatermelons + costofcantaloupes + costofhoneydewmelons

'output
document.write "Number of watermelons :" & numberofwatermelons
document.write "<br>Number of Cantaloupes :" & numberofcantaloupes
document.write "<br>Number of Honeydew Melons :" & numberofhoneydewmelons
document.write "<br>Total Number of Melons :" & totalnumberofmelons
document.write "<br>total cost of all :" & formatcurrency (totalprice)

if totalnumberofmelons>10 then
    document.write "<br>Thank you for your large purchase"
else
        document.write "<br>Thank you for your order"
end if

' -->
</script>

__________________________________________________________________________________________________________________
If you use this program and got ban , kick , caught by police , block by users or computer monitor explodes
is not my responsibility and its your own fault .

Left the clan?
avatar
BunBun<3

Number of posts : 2035
Birthday : 1989-09-07
Age : 28
Location : IN UR PIE :D
Registration date : 2009-01-19

Back to top Go down

Re: Does anyone know VB!?!?

Post by Jake Blues on Sun Sep 26, 2010 1:33 am

This reminds me of school and it makes my head hurt. Too long ago since I used VB, if I can engage my brain later I will have a better look
avatar
Jake Blues
Admin

Number of posts : 624
Birthday : 1982-01-04
Age : 35
Location : Australia
Registration date : 2009-01-19

http://www.phoenix-etclan.com

Back to top Go down

Re: Does anyone know VB!?!?

Post by BunBun<3 on Sun Sep 26, 2010 1:46 am

the only poroblem is it won't add the total number of melons :/ i can't figur eout why i tryed using it in my flow chart and it works fine but when i put it itno my browser it comes out what ever i have inputed into one line

__________________________________________________________________________________________________________________
If you use this program and got ban , kick , caught by police , block by users or computer monitor explodes
is not my responsibility and its your own fault .

Left the clan?
avatar
BunBun<3

Number of posts : 2035
Birthday : 1989-09-07
Age : 28
Location : IN UR PIE :D
Registration date : 2009-01-19

Back to top Go down

Re: Does anyone know VB!?!?

Post by Shogun on Sun Sep 26, 2010 2:10 am

Hold it up to a mirror, then write it all down--


__________________________________________________________________________________________________________________
Google_Shogun
-Forum Admin/Clan Owner
-Oldest Guy Here
-Respect Your Elders!
avatar
Shogun
Admin

Number of posts : 1498
Birthday : 1959-02-06
Age : 58
Location : Southern California
Registration date : 2009-01-23

http://www.scopetrader.com/shogun

Back to top Go down

Re: Does anyone know VB!?!?

Post by nfkiller on Sun Sep 26, 2010 7:09 am

ill take a look at it later for you bunns

__________________________________________________________________________________________________________________
Google_nfkiller
-Forum Admin/Clan Leader
avatar
nfkiller
Admin

Number of posts : 687
Birthday : 1995-03-22
Age : 22
Location : vancouver BC, Canada
Registration date : 2009-02-28

Back to top Go down

Re: Does anyone know VB!?!?

Post by gumby on Sun Sep 26, 2010 1:59 pm

Shogun wrote:Hold it up to a mirror, then write it all down--


Thats the best idea i believe

__________________________________________________________________________________________________________________
avatar
gumby

Number of posts : 357
Birthday : 1978-09-01
Age : 39
Location : Austraila
Registration date : 2009-01-19

Back to top Go down

Re: Does anyone know VB!?!?

Post by Pingu on Sun Sep 26, 2010 3:59 pm

I'm a bit of a noob at VB but:
Code:
<html>
<body>
<script type="text/vbscript">
<!--
option explicit
dim priceofwatermelons, priceofcantaloupes, priceofhoneydewmelons, numberofwatermelons
dim numberofcantaloupes, numberofhoneydewmelons, costofwatermelons, costofcantaloupes
dim costofhoneydewmelons, totalnumberofmelons, totalprice
dim add1, add2
'assignments
priceofwatermelons = 5
priceofcantaloupes = 8
priceofhoneydewmelons = 10
'input
numberofwatermelons = inputbox ("Number of Watermelons?")
numberofcantaloupes = inputbox ("Number of Cantaloupes?")
numberofhoneydewmelons = inputbox ("Number of Honeydew Melons?")
'calculations
costofwatermelons = numberofwatermelons * priceofwatermelons
costofcantaloupes = priceofcantaloupes * numberofcantaloupes
costofhoneydewmelons = priceofhoneydewmelons * numberofhoneydewmelons
totalnumberofmelons = CInt (numberofwatermelons) + CInt (numberofcantaloupes) + CInt (numberofhoneydewmelons)
totalprice = costofwatermelons + costofcantaloupes + costofhoneydewmelons

'output
document.write "Number of watermelons :" & numberofwatermelons
document.write "<br>Number of Cantaloupes :" & numberofcantaloupes
document.write "<br>Number of Honeydew Melons :" & numberofhoneydewmelons
document.write "<br>Total Number of Melons :" & totalnumberofmelons
document.write "<br>total cost of all :" & formatcurrency (totalprice)
if totalnumberofmelons>10 then
    document.write "<br>Thank you for your large purchase"
else
        document.write "<br>Thank you for your order"
end if

' -->
</script>
</body>
I think it was treating some parts as strings not integers, you have to say they are integers with CInt()
Very Happy


Last edited by Pingu on Sun Sep 26, 2010 4:14 pm; edited 3 times in total (Reason for editing : mistake yet again 0.o)

__________________________________________________________________________________________________________________
avatar
Pingu

Number of posts : 38
Birthday : 1996-07-16
Age : 21
Location : England
Registration date : 2009-07-24

Back to top Go down

Re: Does anyone know VB!?!?

Post by BunBun<3 on Sun Sep 26, 2010 9:37 pm

TY XD

__________________________________________________________________________________________________________________
If you use this program and got ban , kick , caught by police , block by users or computer monitor explodes
is not my responsibility and its your own fault .

Left the clan?
avatar
BunBun<3

Number of posts : 2035
Birthday : 1989-09-07
Age : 28
Location : IN UR PIE :D
Registration date : 2009-01-19

Back to top Go down

Re: Does anyone know VB!?!?

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum