I cannot successfully add a custom user control to a form when following the instruction in chapter 13 (I get an error message) but I did find an alterative that works every time. Here's what to do:
First, create a "Windows Control Library"
project and name it "MyControl"
Next, create a user control and add some objects - follow steps 1 thru 6, beginning on page 505 (or create your own sample if you want)
Next, "build" the control (this creates the DLL file that contains the control) then do a Save All. Close the project as we don't need it open any longer
Next, Create a new "Windows Application"
project and call it âControlsâ
Next, add a new toolbar tab and name it "User Controls"
Next, right-click on your new tab and select âcustomize toolbarâ. Click on the ".NET components" tab then click on Browse. Traverse to the "Bin" folder containing hte DLL file that contains your user control. Click on "Open" and the DLL will be added to the list of .NET framework components. Your user control will be added to the User Controls tab
Next, double-click on the user control and it will be added to your form. You can now use your custom user control on any project! :)
Note that these steps are for visual studio version 2002. The steps are a bit different for verion 2003 (easier actually)