Objectives:

  • Start working with Visual Basic
A Visual Basic Program to Turn Pictures On and Off with Buttons
  1. Create a new Visual Basic Project (Standard EXE).

  2. Click the picture icon on the toolbar and drag a picture box onto your form.



  3. Click on the picture property and select a picture from your folder.



  4. Change the visible property of the picture to false.

  5. Click on the label icon of the toolbar. And put a label on your form.



  6. Delete its caption from the caption property and type: "My Picture Project."

  7. Drag a command button onto the form.

  8. Change its caption to: "on."

  9. Add another command button. Change its caption to: "off."

  10. Double-click the "on" button and add the following code:
    picture1.visible=true

  11. Double-click the "off" button and add the following:

    picture1.visible=false

  12. Run your program!

Assignment

Create a Visual Basic program that consists of three pictures. Make on and off buttons for each picture.

<< Back to Skyline