This is a discussion on "[SOLVED] Visual Basic Help Please" within the Scripts and Online Services section. This forum, and the thread "[SOLVED] Visual Basic Help Please are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] Visual Basic Help Please
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
||||
|
||||
|
[SOLVED] Visual Basic Help Please
Not sure if this is the correct place for this-sorry if not.
I have just started learning visual basic to try and add to my coding knowledge. I've been working on a simple calculator application that could be used in schools for young children. Basically, it asks the kids to enter 2 numbers into 2 seperate boxes. They then have to predict what the answer will be if the numbers are added/multiplied/subtracted/divided. They then click a button. There are 4 buttons (Add, multiply, divide, subtract) and they click one. The correct answer is displayed. That all works. I then tried to add a msgbox that would appear telling them whether they guessed right or not. This is where my problem lies. I have managed to right all the code, but I am getting an error 'End of Statement Expected) on the 'End If' text.
Jack
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
|
|
|
#2
|
||||
|
||||
|
Re: Visual Basic Help Please
To be honest, I think the compiler is confused.
I think if you space out the code, it will be fine. As a matter of coding practice, you should always use indentation on if else end if statements so you can clearly see whats going on. Always try to have lines of code that are not too long to aid readability. In the case of visual basic, the code is compiled so it doesnt matter how spaced out your source code is... make it as pretty as you like, the executable will always be the same size. here is an amended code block:-
Private sub, end if, end sub..... those are valid - note the spacing! Good luck!
__________________
Click the 'Thanks!' button if this post has helped you Rob - Webforumz Founder
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
Last edited by Rob; Sep 16th, 2007 at 17:44. |
|
#3
|
||||
|
||||
|
Re: Visual Basic Help Please
Thank you! That got rid of the error. However, it then wasn't giving the right message box-it would always give an incorrect answer. For those who would like to know, here is the correct code:
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] Basic database to call information | hausjellp | PHP Forum | 30 | May 1st, 2008 09:29 |
| [SOLVED] Basic Positioning Issue | Fearpig | Web Page Design | 2 | Apr 15th, 2008 12:30 |
| Web Developer - Visual Basic PHP MySQL | Web JobBot | Job Opportunities | 0 | Feb 1st, 2007 11:20 |
| Visual Basic Help Needed | DJB MASTER | Other Programming Languages | 0 | Nov 16th, 2006 12:47 |