Toolbox and UserControls

mooman_fl

Centurion
Joined
Nov 3, 2002
Messages
193
Location
Florida, USA
Right now I am working on a DLL that consist of several UserControls. At the moment they all show in the toolbox at design time. One of the controls however I want to be internal only. (ie... only usuable from within another control and not sepearately.)

To clarify this... I have a control (ToolScroll) that will be able to add the second control (ToolPanel) to itself dynamically at design time (via designer) or runtime (via exposed methods). However I don't want the Toolpanel available in the Toolbox. I only want this control to be availble second-hand through the Toolscroll control.

Anyideas? I tried just declaring the ToolPanel class as Private but was told that this could only be declared inside another type.
 
Already tried that approach since that worked to keep other classes I had from showing up for the end user. While it keeps the control from being used on a form... it still shows up in the toolbox.
 
All the sources that I have looked up on this show the ToolBoxItem(false) implemented like this:

Visual Basic:
<ToolboxItem(False)> _
Public Class ToolPanel

However when I do this it still shows up in my toolbox... I have saved, rebuilt, and even closed down the IDE and reopened it. Below is my actual code:

Visual Basic:
Imports System.Windows.Forms.Design
Imports System.ComponentModel


<ToolboxItem(False)> Friend Class ToolPanel

Any idea what I am missing or what I should be looking at?
 
It might only be showing up because you're in the project that contains the usercontrol. Have you tried compiling your control library and adding the compiled class to the toolbox from another app? That ToolboxItem(False) has worked for me before.
 
Well that seemed to do it. It just gets confusing when all other changes you make show up in the IDE on your project but that doesn't.

On a side note... what is the best way to add a toolbox icon to your control? I have another control in the same DLL that WILL show in the toolbox.
 
Thanks alot divil... that did it. Well now to finish up my control. It will be a free .NET control to mimic the scroller control and collapsable groupboxes used in 3D Studio Max. I will release it and post a link in a day or so when it is done.
 
Back
Top