Visual Basic Language Samples

Updated: May 2011

These samples demonstrate various Visual Basic language features.

To access samples from Visual Studio

  1. On the Help menu, click Samples.

  2. In the Samples on Disk section of the readme file, click local Samples folder. By default, the samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\1033 or drive:\Program Files (x86)\Microsoft Visual Studio 10.0\Samples\1033.

  3. Right-click the .zip file that contains the samples you want to open and then click Extract All to extract the samples to a folder of your choice.

For the most current samples, go to the Visual Basic Samples Web site.

Security noteSecurity Note

Microsoft provides the included samples "AS IS" with no warranties. The code in the samples is provided just to illustrate concepts. The provided code may not meet security requirements for any specific environment. We recommend that you add security and error-handling code to your projects to make them as secure and robust as you deem appropriate.

Sample

Description

API Call Sample

Demonstrates calling Win32 API functions to enumerate and control processes and windows, and to query and change system settings.

Array Sample

Creates arrays of Integer and Object values, and sorts and searches arrays.

Auto-Implemented Properties Sample

Contains a source file that uses auto-implemented properties, and a similar source file that uses standard (or expanded) property syntax.

Collection Initializers Sample

Demonstrates how to use collection initializer syntax to create arrays and collections.

Covariance Sample

Demonstrates the covariance and contravariance features, showing how to use the In and Out keywords when you declare generic interface type parameters.

Custom Exception Sample

Demonstrates custom exceptions and global exception handling.

DateTime and TimeSpan Sample

Demonstrates how the DateTime and TimeSpan methods work.

File System Sample

Demonstrates the how to use FileSystem methods.

Generics Sample

Shows how to create various generic collections and how to manipulate them.

Implicit Line Continuation Sample

Contains a source file that uses implicit line continuations, and a similar source file that uses explicit line continuations.

Statement Lambdas Sample

Demonstrates statement lambdas, which enable you to declare procedures that have multiple statements inside other procedures.

String Formatting Sample

Shows how to display numeric, date/time, and enumeration values as strings by using a variety of standard and custom culture-specific format codes.

String Sample

Demonstrates how to use String methods.

Try…Catch Sample

Shows how to handle exceptions in applications by using the Try...Catch...Finally Statement (Visual Basic).

Visual Basic Language Features Sample

Highlights several Visual Basic language features, including generics, operator overloading, and the Using keyword.

Visual Basic Object-Oriented Programming Sample

Demonstrates the options available with object-oriented programming.

XML Comments Sample

Demonstrates the XML comment feature of Visual Basic.

Date

History

Reason

May 2011

Listed additional samples.

Content bug fix.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft