Visual Basic Conventions

The “rules” for Visual Basic (VB) code are very simple:

  • VB is a case-insensitive programming language; that is, the compiler ignores case when reading VB code. So myVar, MyVar, MYvar, and MYVAR all refer to the same variable. Note that Visual Studio imposes a uniform casing on all language elements, although this is not a requirement of the compiler.

  • White space (except for line breaks) is ignored when reading VB code.

  • Line breaks mark the end of a complete statement; complete VB statements must occupy a single line.

  • If you want to break a single statement over several lines, you can use the line continuation character, an underscore (_), which must be preceded by a space and must be the last character on the line that is to be continued.

  • If you want to combine multiple statements on a single line, you can use the colon (:). Among other uses, it is commonly used to imitate C++ and C# syntax for inheritance. For example, the code fragment:

    Public Class MainForm
       Inherits Form 

    can be shortened as follows:

    Public Class MainForm : Inherits Form
  • Two comment symbols are used: the apostrophe (') and the Rem keyword. They may appear at any place within a line.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.50.29