Visual Basic Tutorial---How to Write Codes

Visual Basic Tutorial---How to Write Codes thumbnail
Visual Basic computer code follows a certain syntax.

Writing Visual Basic code is best done inside the premade developer environments created by Microsoft specifically for the Visual Basic programming language. The full version of Visual Studio.NET allows you to create complex software applications that can be fully interactive, and the free version of Visual Basic Express allows you to learn and interact with the Visual Basic language creating simpler applications. Visual Basic Express is available as a free download from Microsoft.com. Either developer environment is needed to take full advantage of the robustness of the Visual Basic language.

Things You'll Need

  • Visual Studio.NET installed on a PC
  • Visual Basic Express installed on a PC (optional)
Show More

Instructions

    • 1

      Open your developer environment to the start page. Click Project next to the word Create in the upper left-hand corner of the start page. Another window opens containing fourteen choices. Pick Windows Form Application and type the name of your new project in the Name box below. Click OK when you finish.

    • 2

      Click View from the upper menu choices and choose Tool Box. A left-side panel appears in your new work area. Scroll through each folder within the Tool Box to familiarize yourself with the different premade objects that you can click and drag to the blank grid to your right. Adding these different items as you need them causes the developer environment to add partial code for you. You need only to customize each object's code to make it do what you want.

    • 3

      Click and drag a Button from the Tool Box and drag it to the blank grid to the right.
      Double-click Button on the grid to take you to the coding screen.

    • 4

      Type "MsgBox.Text = ("This is Visual Basic code in action.")" without the outer quotations between the Private Sub and End Sub notations.

    • 5

      Press the F5 key on your keyboard to run your new application. Your application will appear in a new window. Click Button and your message should display in a separate box. Click on both X's in the upper right-hand corner of the windows to return to you the developer environment.

    • 6

      Double-click Button again. Erase the phrase between the () marks and type "I like Visual Basic" with the quotation marks. Repeat step 5.

    • 7

      Save your files and close your work when you are finished.

Tips & Warnings

  • The Visual Basic language follows the logic of the following syntax: "NameofyourObject.Propertyoftheobject = whatYouassignYourObject" without the outer quotes. This is the case with most objects within Visual Basic. More advanced code writing includes more complex situations beyond the scope of this article.

  • The Visual Basic developer environments will underline any errors you make in syntax with blue, red or green squiggly lines. You must fix these before your application will work properly.

Related Searches:

References

  • Photo Credit cables 1 image by juanjo tugores from Fotolia.com

Comments

You May Also Like

Related Ads

Featured