Testing Your User Control
In this lesson, you will learn how to test your user control in another project and observe its run-time behavior.
Once you have completed your user control and tested its design-time behavior in the TestContainer, you will also want to see how it behaves when used in a program. Visual Basic makes it easy to test your user control by adding a Windows Application project.
Your user control automatically appears in the Toolbox, and you can add it to a form and set its properties just as you would with any other control.
To test your user control
Open the NamesUserControl project that you created in the previous lesson. If you did not save it, you will first need to go back to the previous lesson, Adding Code to Your User Control, and complete the procedures in that lesson.
On the File menu, point to Add and click New Project.
In the Add New Project dialog box, select Windows Application.
In the Name box, type UserControlTest, and then click OK.
A new project will be added in Solution Explorer, and a new form will be displayed.
In Solution Explorer, select the UserControlTest project, and on the Project menu, select Set as StartUp Project.
In the Toolbox, select NamesControl and drag it to the form.
In the Properties window, set the FirstNameText, MiddleNameText, and LastNameText properties to match your name.
Press F5 to run the program. Change the names in the text boxes to make sure the label updates correctly.
On the File menu, choose Save All to save your work.
In this lesson, you learned how to add your user control to a form and observe its run-time behavior. At this point, you can learn more about user controls in Closer Look: Customizing Your User Control, or you can go on to the next group of lessons and learn about graphics.
Next Lesson: Drawing Pictures: Using Graphics