Computing Students - Computer Science Degree Notes
Home Contact Shop Notes Questions Programming Links Dictionary Coursework FORUM Tutors
  Recommended Amazon Searches: Computer Science | Computing | Computer Systems | Database | Computing Revision  

Programming > Visual Basic > Tutorial > 6 - Writing and Running Code

Now you can type in the single line of code shown below:

    Private Sub Command1_Click()
    MsgBox ("Hello")
    End Sub

Once you have done this, find the Start button on the toolbar at the top of the screen. When you click this, your program will run. This shows you exactly how the form will look when it is viewed by a user running your program.

If you now click on the button which is on your form, you see the following message box appear.

Click OK to close the message box. Your form will still be running so if you want to edit or add any code to it you need to close it. You can do this by either pressing the End button on the top toolbar (near the Start button), or you can press the cross that is at the top right corner of the form.

Now you can try changing the message that appears in the message box by changing the text between the speech marks and brackets in the code. To test it, simply press the Start button again to run the form. When you have finished just press End.

Once you are happy with running your form and then stopping it, you can move on to the next step: Ending a VB Program

Search for "Visual Basic" on: Google | Kelkoo | Amazon | eBay (UK) | eBay (US)

Search for "Visual Basic" on the rest of Computing Students: Visual Basic

Find Visual Basic (VB) Programming Books in the Computing Students Computer Science Book Shop

Home | Contact | Shop | Notes | Questions | Programming | Links | Dictionary | Coursework | Tutors Sponsored Links: Affiliate Program Articles | Computer Science Definitions | CS Degree Notes
Copyright © 2005-2009
This site is to be used in accordance with the User Agreement
High Wycombe Web Design