Code Editor Window in Visual Basic

Saturday, August 22, 2009 ·

Code Editor Window in Visual Basic
In the earlier posting I've told you that a VB Project maybe contains one or more files like form, module, and so on. One form usually contains one or more controls. However a form with it's control contained on it can't do anything without code statements (programming code) that associate with them. And a module also contains one or more statements.

A place in VB Development Environment where you can write your VB code statements (programming code) is called Visual Basic Code Editor Window. It's also known as the Code Window. A sparate Code Editor Window is displayed for each form or module in your project, making it easy to organize, view, and navigate.

There are two drop-down lists at the top of the Code Editor Window called Object List and Procedure List.The Object list contains a list of all the Contols that exist on the form. When you selectiong a control name from the list, the Procedure list shows all the events (actions) for the control.

Using the Object and Procedure list together, can make you easy to located and edit the code you want in your VB application. The image above (on the top of posting)illustrates the Code Editor Window.

To open the Visual Basic Code Editor Window you can follow the following steps:

  • In the Project Explorer window, click the form which code you want to open
  • Then Click View Code button
    How to open VB Code Editor Window - Click View Code button

    Tips:
    For example: You have a control called txtAmount on your form. You want to write code statements on Sub txtAmount_LostFocus(). How can you do that?
    Ok, you can follow the tips below:
  • Click the Form in the Project Explorer window
  • Click View Code button

  • In the Code Editor window, click txtAmount from the Object list
    VB Code Editor Window

  • Then click LostFocus from the Procedure list
    VB Code Editor Window

    So, Sub txtAmount_LostFocus() appears on your screen (in the Code Editor window) and you can write your code statements you want.
    VB Code Editor Window


  • 0 comments:

    Post a Comment