Skip to content

Latest commit

 

History

History
89 lines (68 loc) · 5.31 KB

File metadata and controls

89 lines (68 loc) · 5.31 KB
title Program Structure and Code Conventions (Visual Basic)
ms.custom
ms.date 07/20/2015
ms.prod .net
ms.reviewer
ms.suite
ms.technology
devlang-visual-basic
ms.topic article
helpviewer_keywords
coding conventions
Visual Basic code, coding conventions
coding conventions [Visual Basic], Visual Basic
programs [Visual Basic], structure
program structure [Visual Basic]
naming conventions [Visual Basic], Visual Basic
best practices [Visual Basic], coding conventions
conventions [Visual Basic], Visual Basic coding
Visual Basic code
programming [Visual Basic], Visual Basic coding conventions
ms.assetid dd9be76f-6944-4e78-ad72-0b6084a3fc13
caps.latest.revision 21
author dotnet-bot
ms.author dotnetcontent

Program Structure and Code Conventions (Visual Basic)

This section introduces the typical [!INCLUDEvbprvb] program structure, provides a simple [!INCLUDEvbprvb] program, "Hello, World", and discusses [!INCLUDEvbprvb] code conventions. Code conventions are suggestions that focus not on a program's logic but on its physical structure and appearance. Following them makes your code easier to read, understand, and maintain. Code conventions can include, among others:

  • Standardized formats for labeling and commenting code.

  • Guidelines for spacing, formatting, and indenting code.

  • Naming conventions for objects, variables, and procedures.

The following topics present a set of programming guidelines for [!INCLUDEvbprvb] programs, along with examples of good usage.

In This Section

Structure of a Visual Basic Program
Provides an overview of the elements that make up a [!INCLUDEvbprvb] program.

Main Procedure in Visual Basic
Discusses the procedure that serves as the starting point and overall control for your application.

References and the Imports Statement
Discusses how to reference objects in other assemblies.

Namespaces in Visual Basic
Describes how namespaces organize objects within assemblies.

Visual Basic Naming Conventions
Includes general guidelines for naming procedures, constants, variables, arguments, and objects.

Visual Basic Coding Conventions
Reviews the guidelines used in developing the samples in this documentation.

Conditional Compilation
Describes how to compile particular blocks of code selectively while directing the compiler to ignore others.

How to: Break and Combine Statements in Code
Shows how to divide long statements into multiple lines and combine short statements on one line.

How to: Collapse and Hide Sections of Code
Shows how to collapse and hide sections of code in the [!INCLUDEvbprvb] code editor.

How to: Label Statements
Shows how to mark a line of code to identify it for use with statements such as On Error Goto.

Special Characters in Code
Shows how and where to use non-numeric and non-alphabetic characters.

Comments in Code
Discusses how to add descriptive comments to your code.

Keywords as Element Names in Code
Describes how to use brackets ([]) to delimit variable names that are also [!INCLUDEvbprvb] keywords.

Me, My, MyBase, and MyClass
Describes various ways to refer to elements of a [!INCLUDEvbprvb] program.

Visual Basic Limitations
Discusses the removal of known coding limits within [!INCLUDEvbprvb].

Related Sections

Typographic and Code Conventions
Provides standard coding conventions for [!INCLUDEvbprvb].

Writing Code
Describes features that make it easier for you to write and manage your code.