Visual Basic Tutorial for Windows 7

Visual Basic Tutorial for Windows 7 thumbnail
Learn to program using Microsoft's Visual Basic programming language.

Microsoft's free Express version of its Visual Basic programming language makes learning to program a computer an inexpensive proposition for the beginner. In addition, the robustness of the free product makes it an attractive tool for the experienced programmer who needs to develop a more complex application than a beginner would think of tackling. One important factor in the success of the language is the Visual Studio integrated development environment (IDE), which is intuitive and simple to use. The essentials of installing and programming in Visual Basic apply to Windows 7, Windows Vista and Windows XP.

Instructions

    • 1

      Download Visual Basic Express from the Microsoft Express Download Web site (see References). Choose your language preference from the dropdown menu and allow the download to proceed. If prompted by a security warning, click "Run." Read and accept the license agreement and click "Next." Browse to a desired install folder or accept the default by just clicking "Install." Allow the installation to finish.

    • 2

      Click "Start" and key "visual basic" in the "Search box." You should see the Visual Basic Express application appear at the top of the "Programs" list. Click on the Visual Basic Express link to start the application. When the "Start Page" appears, click "New Project," then double-click "Windows Forms Application" to open a new form in the Visual Basic "Design" window. To the left you will see the "Toolbox" tab, and on the right of the screen you will see a "Solutions" window and a "Properties" window. You are now ready to build your first Visual Basic Windows form application.

    • 3

      Open the "Toolbox" menu by scrolling your cursor over the tab or clicking on it. You will see a list of "controls" that Visual Basic provides for you to use to build your application. The most-used sub-menu is the "Common Controls" menu, which contains labels, textboxes, buttons, radio buttons and more. Move the desired control into your form by double-clicking on it or dragging it onto the form. Take the time to arrange your controls in a logical manner to make your application easy to understand and use.

    • 4

      Rename the components from the default names such as "Button1" to something meaningful in your application. For example, if "Button1" is going to provide the ability to print then you should rename it to "Print_Button." This will make your application easier to debug later in the process. To change the name of a control, first select it by clicking on it in the form. Scroll through the properties listed in the "Properties" window until you find the "Name" property and change it to an appropriate name. To change the displayed text for the control just scroll until you find the "Text" property and change it to what you want displayed. For the "Print_Button" you might change the "Text" property to "Print," which will cause the work "Print" to display in the button on the form.

    • 5

      Determine which controls will cause some action to occur and create code for that control. Open the "Code" window by double-clicking on the control. Visual Basic will create a beginning and ending line for an event-handling procedure and place your cursor between those two lines so that you can write your code. While this may seem intimidating, Visual Basic has a feature called "Intellisense" which assists you with both variable names and syntax rules. As you begin to key a line of code this features displays a menu of options from which you can select. Intellisense enhances your coding productivity and reduces errors at the same time.

    • 6

      Debug your code by using Visual Basic's "Debug" options. You can test your program at any time to test incremental changes, which helps you find and eliminate bugs faster. You can step through code one line at a time or test the entire program. One benefit of stepping through the program a line at a time is that you get to see the values stored in the variables so that you can know exactly what is happening in your code. You can also set break-points in the code if you want it to stop at a certain place.

Related Searches:

References

Resources

  • Photo Credit Jupiterimages/Brand X Pictures/Getty Images

Comments

You May Also Like

  • Tools for Visual Basic Style Controls

    Tools for Visual Basic Style Controls. Visual Basic is a programming language and IDE (integrated development environment) developed by Microsoft, which uses...

Related Ads

Featured