Visible Objects: Creating Your First User Control

In the previous set of lessons you learned how to work with classes—blueprints for objects. The classes that you created can be reused in other programs, so that you don't have to write the same code repeatedly.

Controls are also classes that can be reused in multiple projects. You will probably find yourself designing the same user interface repeatedly—for example, adding TextBox controls for entering first and last names, and then adding code to combine them into a full name. Wouldn't it be nice if you could avoid all that extra work?

That's where user controls come in. You can think of a user control as a class for creating visible objects—your own custom controls that can be reused just like the controls that come with Visual Basic. Most user controls are composite controls—that is, controls that are composed of one or more standard Visual Basic controls.

In the following lessons, you will learn how to create a composite user control that you can reuse in other programs.

Understanding the User Control Designer

Explains how to create your own control by using the User Control Designer.

Adding Controls to Your User Control

Explains how to add controls to create a composite user control.

Adding Code to Your User Control

Explains how to add code to a user control to display a name and to expose new properties.

Testing Your User Control

Explains how to test a user control in a project and watch its run-time behavior.

Closer Look: Adding Properties with Named Values

Describes how to add a property that contains a list of values to your user control.

Closer Look: Customizing Your User Control

Demonstrates how to customize a user control by adding labels and default text.

Visual Basic Guided Tour

The Visual Basic Guided Tour is a series of sequential lessons that introduce you to the basics of programming in Visual Basic.

Community Additions