Visual Basic Application Tutorial
Visual Basic applications range from hand-held games and stand alone desktop applications or they can involve Internet and database usage capabilities. Getting your feet wet learning the Visual Basic programming language involves using the different features of the full developer environment of Microsoft Visual Studio.NET or Microsoft's free version of Visual Basic Express downloadable for free at Microsoft.com. Creating an interactive user interface with one or more pictures, user instructions and buttons to click will give you an idea of how the Visual Basic language works.
Things You'll Need
- Picture(s) saved on the computer
- Microsoft Visual Studio.NET
- Microsoft Visual Basic Express (optional)
Instructions
-
-
1
Open the developer environment. Click on "Project" next to the word "Create" on the start page. Choose "Windows Form Application" from the options that populate and type the name of your new software application in the "Name" box below. Click "OK" when you finish.
-
2
Click and drag a "Picture Box" from the "Tool Box" to the blank form to your right and position it in the middle of the form. Let go of the mouse. Click and drag two "Button" objects from the "Tool Box" and place them beneath the picture box.
-
-
3
Link the "Picture Box" to a picture you have saved on your computer or a removable storage drive by clicking on the "Image" field in the "Properties" tab on the right hand side of your screen. Click on the "..." inside the "Image" field. A new window appears.
-
4
Click on "Import" and then "Local Resource." Navigate to the folder where you have your pictures stored. Open your picture folders and click on the picture you want to import. Click on "OK" when you finish. The windows will close returning you to your work form.
-
5
Click on each button one time and navigate to the "Text" field of the "Properties" tab. Erase the default text and type in "Display." Click "Enter" when you finish and do this again for the other button changing its text to "Exit."
-
6
Double-click on the "Display" button and type "MsgBox.text = ("This is a picture.")" without the outer quotation marks between the "Private Sub" and the "End Sub" notations.
-
7
Double-click on the "Exit" button and type "Close ()" without the outer quotation marks between the "Private Sub" and "End Sub" notations.
-
8
Save your work by clicking "File" along the top and then "Save all files." Click on the "green arrow" pointing to the right. Your program displays.
-
9
Click on the "Display" button to see your message display" and then click "Exit" to close the application. Close your developer environment.
-
1
Tips & Warnings
Name your project to indicate what the project does to help you organize your projects once you create several of them. For example, if you are building a time clock application, title it "TimeClockSmith" and not "ProjectNo2." If you cannot see the "Tool Box" or "Properties" tabs, click on "View" in the upper menu choices and click on the tab you want to see to make it appear in the work area.
Coding syntax errors will be highlighted in blue, green or red squiggly underlines. Logic errors are only indicative when you run the program and press the buttons to see if the buttons perform as you intend. If they don't, you must go back through your code and double check each module that affects the function that wont' work.
References
- Photo Credit manila folder with white page attached image by Martin Heaney from Fotolia.com