| View previous topic :: View next topic |
| Author |
Message |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Thu Jan 27, 2011 11:19 pm Post subject: Anybody here know VB? |
|
|
| Simple stuff, I know, but I can't figure out the problem. :l
|
|
| Back to top |
|
 |
Channel GannoK pffrt
Reputation: 130
Joined: 12 Apr 2008 Posts: 608
|
Posted: Thu Jan 27, 2011 11:21 pm Post subject: |
|
|
I know a little. I could be of some help.
_________________
|
|
| Back to top |
|
 |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Thu Jan 27, 2011 11:27 pm Post subject: |
|
|
Well, my professor wants us to code a simple program, this is what I have..
| Code: | Module Furniture
Sub Main()
dim minimum as double = 150.00
dim length as double
dim width as double
dim surface as double
dim overSurface as double
dim overSurfaceDetermine as double = 750.00
dim overSurfaceCharge as double = 50.00
dim overSurfaceNoCharge as double = 0.00
dim woodChoice as string
dim mahogany as double = 200.00
dim oak as double = 100.00
dim pine as double = 0.00
dim leaf as integer
dim leafcost as double = 50.00
dim three as string
dim two as string
dim one as string
dim woodCost as double
dim endTotal as double
dim leafTotal as double
length = InputBox$("Enter length: ")
'get length
width = InputBox$("Enter width: ")
'get width
surface = width * length
if surface > overSurfaceDetermine then overSurface = overSurfaceCharge else overSurface = overSurfaceNoCharge
end if
woodChoice = InputBox$("Enter your choice of wood; one for Pine, two for Oak, three for Mahogany: ")
'get woodChoice
if woodChoice = three then woodCost = mahogany
end if
if woodChoice = two then woodCost = oak
end if
if woodChoice = one then woodCost = pine
end if
leaf = InputBox$("Number of leaves: ")
'get leaf
leafTotal = leaf * leafCost
endTotal = leafTotal + woodCost + overSurface
System.Console.WriteLine("The charge for this table is $" & endTotal)
End Sub
End Module
|
When I try to run VBC, I get an error that states, "'end if' must be preceded by a matching if" when there is clearly one.
I feel like I'm making a stupid mistake, but I can't figure it out, and it's really bugging me. :<
Edit: started the class this week, so.. it's far from as simple as it can be, I know, only know the basics.
|
|
| Back to top |
|
 |
SGL Grandmaster Cheater
Reputation: 14
Joined: 04 May 2007 Posts: 758
|
Posted: Thu Jan 27, 2011 11:31 pm Post subject: |
|
|
VB is the language of gods.
_________________
I'm SirGodlike
 |
|
| Back to top |
|
 |
Channel GannoK pffrt
Reputation: 130
Joined: 12 Apr 2008 Posts: 608
|
Posted: Thu Jan 27, 2011 11:31 pm Post subject: |
|
|
Hmm. Give me a minute. I don't have Visual basic on my computer, in the mean time, try different things and codes.
_________________
|
|
| Back to top |
|
 |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Thu Jan 27, 2011 11:33 pm Post subject: |
|
|
Image related.
| Description: |
|
| Filesize: |
386.9 KB |
| Viewed: |
5037 Time(s) |

|
|
|
| Back to top |
|
 |
Oblivious Grandmaster Cheater Supreme
Reputation: 45
Joined: 12 Mar 2008 Posts: 1732
|
Posted: Thu Jan 27, 2011 11:35 pm Post subject: |
|
|
| well it looks like one of your end ifs is missing an if
|
|
| Back to top |
|
 |
Channel GannoK pffrt
Reputation: 130
Joined: 12 Apr 2008 Posts: 608
|
Posted: Thu Jan 27, 2011 11:35 pm Post subject: |
|
|
Is there an error report?
_________________
|
|
| Back to top |
|
 |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Thu Jan 27, 2011 11:36 pm Post subject: |
|
|
| Erblivious wrote: | | well it looks like one of your end ifs is missing an if |
It's saying all of them are.. :l
|
|
| Back to top |
|
 |
Channel GannoK pffrt
Reputation: 130
Joined: 12 Apr 2008 Posts: 608
|
Posted: Thu Jan 27, 2011 11:37 pm Post subject: |
|
|
"End if"s are supposed to go together I believe.
like so
Endif
_________________
Last edited by Channel GannoK on Thu Jan 27, 2011 11:38 pm; edited 1 time in total |
|
| Back to top |
|
 |
Oblivious Grandmaster Cheater Supreme
Reputation: 45
Joined: 12 Mar 2008 Posts: 1732
|
Posted: Thu Jan 27, 2011 11:38 pm Post subject: |
|
|
| Saucy Balmung wrote: | | Erblivious wrote: | | well it looks like one of your end ifs is missing an if |
It's saying all of them are.. :l |
Oh then look up how to use 'end if', you're probably using it wrong.
|
|
| Back to top |
|
 |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Thu Jan 27, 2011 11:43 pm Post subject: |
|
|
| Erblivious wrote: | | Saucy Balmung wrote: | | Erblivious wrote: | | well it looks like one of your end ifs is missing an if |
It's saying all of them are.. :l |
Oh then look up how to use 'end if', you're probably using it wrong. |
According to the little he gives us, I'm using it right.
@Kyle, I guess I'll try that.
| Description: |
|
| Filesize: |
420.13 KB |
| Viewed: |
5015 Time(s) |

|
|
|
| Back to top |
|
 |
Oblivious Grandmaster Cheater Supreme
Reputation: 45
Joined: 12 Mar 2008 Posts: 1732
|
Posted: Thu Jan 27, 2011 11:45 pm Post subject: |
|
|
| Saucy Balmung wrote: | | Erblivious wrote: | | Saucy Balmung wrote: | | Erblivious wrote: | | well it looks like one of your end ifs is missing an if |
It's saying all of them are.. :l |
Oh then look up how to use 'end if', you're probably using it wrong. |
According to the little he gives us, I'm using it right.
@Kyle, I guess I'll try that. |
Try removing them all except the last one.
|
|
| Back to top |
|
 |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Thu Jan 27, 2011 11:48 pm Post subject: |
|
|
| Erblivious wrote: | | Saucy Balmung wrote: | | Erblivious wrote: | | Saucy Balmung wrote: | | Erblivious wrote: | | well it looks like one of your end ifs is missing an if |
It's saying all of them are.. :l |
Oh then look up how to use 'end if', you're probably using it wrong. |
According to the little he gives us, I'm using it right.
@Kyle, I guess I'll try that. |
Try removing them all except the last one. |
Still get the same error, only it's saying that the one 'end if' I have is missing an 'if'.
edit: Shrooms, no dice, error related.
| Description: |
|
| Filesize: |
497.66 KB |
| Viewed: |
4997 Time(s) |

|
|
|
| Back to top |
|
 |
Oblivious Grandmaster Cheater Supreme
Reputation: 45
Joined: 12 Mar 2008 Posts: 1732
|
Posted: Thu Jan 27, 2011 11:55 pm Post subject: |
|
|
| Saucy Balmung wrote: | | Erblivious wrote: | | Saucy Balmung wrote: | | Erblivious wrote: | | Saucy Balmung wrote: | | Erblivious wrote: | | well it looks like one of your end ifs is missing an if |
It's saying all of them are.. :l |
Oh then look up how to use 'end if', you're probably using it wrong. |
According to the little he gives us, I'm using it right.
@Kyle, I guess I'll try that. |
Try removing them all except the last one. |
Still get the same error, only it's saying that the one 'end if' I have is missing an 'if'.
edit: Shrooms, no dice, error related. |
Remove them all, see if it gives you an error.
|
|
| Back to top |
|
 |
|