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.

In This Section