Visual Basic Windows Forms Samples

These samples demonstrate common tasks for Windows Forms applications.

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.

Samples

Sample

Description

Clipboard Sample

Demonstrates how to copy and retrieve Clipboard items in multiple formats.

Common Dialog Box Components Sample

Demonstrates how to use the OpenFileDialog, SaveFileDialog, ColorDialog, and FontDialog components to work with files, colors, and fonts.

Custom Drawing User Control Sample

Demonstrates how to create custom-drawn user controls, use them on a form, enable them to respond to events, and define properties for use in Design view.

Drag-and-Drop Sample

Demonstrates drag-and-drop functionality with text, images, and tree-view nodes.

Dynamic Control Creation Sample

Demonstrates how to add controls to a form in a Windows Forms application at run time.

Explorer-Style Application Sample

Contains two forms that have split-pane windows, similar to Windows Explorer.

GDI + Animation Sample

Demonstrates how to implement animation, such as moving text, a bouncing ball, and an animated image, by using the System.Drawing namespace objects.

GDI+ Brushes Sample

Demonstrates how to customize a brush by using the Brush object.

GDI+ Images Sample

Demonstrates the manipulation of images. Manipulations include zooming, resizing, rotating, and clipping.

GDI+ Pen Sample

Demonstrates how to customize a pen by using the Pen object.

GDI+ Text Sample

Shows the effects of text options. Text options include shadow, embossing, block text, shearing, and reflection.

Help Files Sample

Shows how to add Help to a Windows-based application by using the ToolTip, HelpProvider, and ErrorProvider controls.

ListBox and ComboBox Sample

Demonstrates several basic ListBox and ComboBox tasks, such as adding items, binding to a database table, and accessing a selected item.

Menus Sample

Demonstrates how to use MenuStrip controls in Windows Forms applications to create menus at runtime and handle menu events.

NotifyIcon Sample

Demonstrates how to create a program that displays an icon in the notification area by using the NotifyIcon control and its associated ContextMenu.

Printing Sample

Demonstrates how to use the My.Printers object to print text and configure a printer.

Regular Expressions Sample

Demonstrates how to validate user input by using the Regex class, which represents regular expressions.

StatusStrip Control Sample

Demonstrates how to display various types of data visually in the StatusStrip control.

Text Validation Sample

Provides a comparison of two ways of validating text: by using regular expressions in a custom TextBox control and by using the MaskedTextBox component.

Top-Level Forms Sample

Demonstrates how to implement an application that supports multiple windows that appear separately in the taskbar.

Visual Inheritance Sample

Shows how you can use inheritance with Windows Forms.

Web Browser Sample

Demonstrates how to create a simple Web browser by using the WebBrowser control.

See Also

Other Resources

Visual Studio 2010 Samples

Visual Basic Sample Applications