View Single Post
  #1 (permalink)  
Old June 18th, 2003, 03:48 PM
msjolin msjolin is offline
Registered User
Join Date: Jun 2003
Location: seattle, WA, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 13 - Creating Your Own Custom Controls

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)

Mark Sjolin