Home All Groups Group Topic Archive Search About

How to add control/component to the IDE toolbar

Author
14 May 2009 12:53 AM
Mike
I've been trying to create a VB.NET window control and add it to the
toolbar where a vb.net form application can click, drag and drop into
  his form.

Been reading all the MSDN docs and can't seem to find how this is
done. I'm  sure its very simple and  I'm over thinking something.

In  VB6  it was easy because I could right click the toolbar and add
the control.   The right click property window under VS2005 toolbar
has a "Show Items..." but no "add control" idea. It has an Add Tab but
no add control.

Can someone steer me right here?  It will be greatly appreciated.

Thanks

--

Author
14 May 2009 1:20 AM
Tom Shelton
On 2009-05-14, Mike <unkn***@unknown.tv> wrote:
Show quoteHide quote
> I've been trying to create a VB.NET window control and add it to the
> toolbar where a vb.net form application can click, drag and drop into
>   his form.
>
> Been reading all the MSDN docs and can't seem to find how this is
> done. I'm  sure its very simple and  I'm over thinking something.
>
> In  VB6  it was easy because I could right click the toolbar and add
> the control.   The right click property window under VS2005 toolbar
> has a "Show Items..." but no "add control" idea. It has an Add Tab but
> no add control.
>
> Can someone steer me right here?  It will be greatly appreciated.
>
> Thanks
>
> --

When you right click, do you see a "Choose Items" option?

--
Tom Shelton
Author
14 May 2009 1:34 AM
Mike
Tom Shelton wrote:
Show quoteHide quote
> On 2009-05-14, Mike <unkn***@unknown.tv> wrote:
>> I've been trying to create a VB.NET window control and add it to the
>> toolbar where a vb.net form application can click, drag and drop into
>>   his form.
>>
>> Been reading all the MSDN docs and can't seem to find how this is
>> done. I'm  sure its very simple and  I'm over thinking something.
>>
>> In  VB6  it was easy because I could right click the toolbar and add
>> the control.   The right click property window under VS2005 toolbar
>> has a "Show Items..." but no "add control" idea. It has an Add Tab but
>> no add control.
>>
>> Can someone steer me right here?  It will be greatly appreciated.
>>
>> Thanks
>>
>> --
>
> When you right click, do you see a "Choose Items" option?

Yes, but I don't see the my .NET dll. I guess it has to be registered
or something?

--
Author
14 May 2009 7:26 AM
Mike
Tom Shelton wrote:
> On 2009-05-14, Mike <unkn***@unknown.tv> wrote:

>> Can someone steer me right here?  It will be greatly appreciated.
>>
>> Thanks
>>
>> --
>
> When you right click, do you see a "Choose Items" option?

Phew! I finally got it.  Can you tell me if there is a more straight
forward IDE procedure or this the following is basically correct?

                --------------------
     How to create a NON-UI Toolbox Component that will
     appear in the Component Tray (not on a Windows form)
     when dropped on a form.

Step 1) Create a New Project selecting the Class Library template.

Step 2) For the new  project, click PROJECT | ADD COMPONENT

Step 3) Compile and create the DLL

Adding the component to the Toolbox

You can add the component to the Toolbox General Tab or create a new
tab in the Toolbox. In this example, the General tab is used.

Step 4) Select the general tab in the Toolbox, right click and select
         "Choose Items..."

Step 5) Click Browse and find the location of your DLL, click OK.

The component *SHOULD* appear in the toolbox General tab.

o Testing

Step 6) Create a new Windows Application project.

Step 7) Display the form and drop the component.

The component *SHOULD* appear in the COMPONENT TRAY at the bottom  of
the form display.
                --------------------

Overall, what I found, unless I did something wrong, selecting a
Windows Control Library Project did not work. This creates a UI user
control. I had to create a class library then add a component to it.
Simple of course, but if you never done it before, it isn't obvious.

In short, IMO, there should be a new project template called:

   Windows Component Library

with a description

   A project for creating NON-UI ToolBox components to use in Windows
   applications

Is there some IDE method that does this?

I believe I saw convert options somewhere, don't recall where, maybe
in the class explorer, that saids

     Convert Class to Component ...
     Convert Class to Control ...

That is what give me the idea of doing the steps above because I
didn't recall where these options were at.

Anyway, maybe this will help the next .NET newbie because every
example I found on MSDN and else where was for creating UI components. :-)

Thanks for all your input.

--
Author
14 May 2009 8:19 AM
James Hahn
OK, but does it appear it in the toolbox with it's own icon?

Show quoteHide quote
"Mike" <unkn***@unknown.tv> wrote in message
news:ekUkWVG1JHA.1900@TK2MSFTNGP04.phx.gbl...
> Tom Shelton wrote:
>> On 2009-05-14, Mike <unkn***@unknown.tv> wrote:
>
>>> Can someone steer me right here?  It will be greatly appreciated.
>>>
>>> Thanks
>>>
>>> --
>>
>> When you right click, do you see a "Choose Items" option?
>
> Phew! I finally got it.  Can you tell me if there is a more straight
> forward IDE procedure or this the following is basically correct?
>
>                --------------------
>     How to create a NON-UI Toolbox Component that will
>     appear in the Component Tray (not on a Windows form)
>     when dropped on a form.
>
> Step 1) Create a New Project selecting the Class Library template.
>
> Step 2) For the new  project, click PROJECT | ADD COMPONENT
>
> Step 3) Compile and create the DLL
>
> Adding the component to the Toolbox
>
> You can add the component to the Toolbox General Tab or create a new tab
> in the Toolbox. In this example, the General tab is used.
>
> Step 4) Select the general tab in the Toolbox, right click and select
>         "Choose Items..."
>
> Step 5) Click Browse and find the location of your DLL, click OK.
>
> The component *SHOULD* appear in the toolbox General tab.
>
> o Testing
>
> Step 6) Create a new Windows Application project.
>
> Step 7) Display the form and drop the component.
>
> The component *SHOULD* appear in the COMPONENT TRAY at the bottom  of the
> form display.
>                --------------------
>
> Overall, what I found, unless I did something wrong, selecting a Windows
> Control Library Project did not work. This creates a UI user control. I
> had to create a class library then add a component to it. Simple of
> course, but if you never done it before, it isn't obvious.
>
> In short, IMO, there should be a new project template called:
>
>   Windows Component Library
>
> with a description
>
>   A project for creating NON-UI ToolBox components to use in Windows
>   applications
>
> Is there some IDE method that does this?
>
> I believe I saw convert options somewhere, don't recall where, maybe in
> the class explorer, that saids
>
>     Convert Class to Component ...
>     Convert Class to Control ...
>
> That is what give me the idea of doing the steps above because I didn't
> recall where these options were at.
>
> Anyway, maybe this will help the next .NET newbie because every example I
> found on MSDN and else where was for creating UI components. :-)
>
> Thanks for all your input.
>
> --
Author
14 May 2009 9:06 AM
Mike
It adds what looks to be a generic stub icon - a cyan colored gear
(circle with teeth) icon.  I presumed I would be able to add one to
the component resources.  I don't see a property for it, only three:

   + Design
     (NAME)     :  WildcatComponent
     Language   :  (Default)
     Localizable:  FALSE

Thanks

James Hahn wrote:
Show quoteHide quote
> OK, but does it appear it in the toolbox with it's own icon?
>
>>
>> Phew! I finally got it.  Can you tell me if there is a more straight
>> forward IDE procedure or this the following is basically correct?
>>
>>                --------------------
>>     How to create a NON-UI Toolbox Component that will
>>     appear in the Component Tray (not on a Windows form)
>>     when dropped on a form.
>>
>> Step 1) Create a New Project selecting the Class Library template.
>>
>> Step 2) For the new  project, click PROJECT | ADD COMPONENT
>>
>> Step 3) Compile and create the DLL
>>
>> Adding the component to the Toolbox
>>
>> You can add the component to the Toolbox General Tab or create a new
>> tab in the Toolbox. In this example, the General tab is used.
>>
>> Step 4) Select the general tab in the Toolbox, right click and select
>>         "Choose Items..."
>>
>> Step 5) Click Browse and find the location of your DLL, click OK.
>>
>> The component *SHOULD* appear in the toolbox General tab.
>>
>> o Testing
>>
>> Step 6) Create a new Windows Application project.
>>
>> Step 7) Display the form and drop the component.
>>
>> The component *SHOULD* appear in the COMPONENT TRAY at the bottom  of
>> the form display.
>>                --------------------
>>
>> Overall, what I found, unless I did something wrong, selecting a
>> Windows Control Library Project did not work. This creates a UI user
>> control. I had to create a class library then add a component to it.
>> Simple of course, but if you never done it before, it isn't obvious.
>>
>> In short, IMO, there should be a new project template called:
>>
>>   Windows Component Library
>>
>> with a description
>>
>>   A project for creating NON-UI ToolBox components to use in Windows
>>   applications
>>
>> Is there some IDE method that does this?
>>
>> I believe I saw convert options somewhere, don't recall where, maybe
>> in the class explorer, that saids
>>
>>     Convert Class to Component ...
>>     Convert Class to Control ...
>>
>> That is what give me the idea of doing the steps above because I
>> didn't recall where these options were at.
>>
>> Anyway, maybe this will help the next .NET newbie because every
>> example I found on MSDN and else where was for creating UI components.
>> :-)
>>
>> Thanks for all your input.
>>
>> --
>
Author
14 May 2009 9:58 AM
Mike
Piece of cake!

<ToolboxBitmapAttribute(GetType(WildcatComponent), "cateyes.ico")> _
Public Class WildcatComponent
End Class

Using this method, change the icon file properties Build Action to
Embedded Resource.

..NET ROCKS!

--


Mike wrote:
Show quoteHide quote
> It adds what looks to be a generic stub icon - a cyan colored gear
> (circle with teeth) icon.  I presumed I would be able to add one to the
> component resources.  I don't see a property for it, only three:
>
>   + Design
>     (NAME)     :  WildcatComponent
>     Language   :  (Default)
>     Localizable:  FALSE
>
> Thanks
>
> James Hahn wrote:
>> OK, but does it appear it in the toolbox with it's own icon?
>>
>>>
>>> Phew! I finally got it.  Can you tell me if there is a more straight
>>> forward IDE procedure or this the following is basically correct?
>>>
>>>                --------------------
>>>     How to create a NON-UI Toolbox Component that will
>>>     appear in the Component Tray (not on a Windows form)
>>>     when dropped on a form.
>>>
>>> Step 1) Create a New Project selecting the Class Library template.
>>>
>>> Step 2) For the new  project, click PROJECT | ADD COMPONENT
>>>
>>> Step 3) Compile and create the DLL
>>>
>>> Adding the component to the Toolbox
>>>
>>> You can add the component to the Toolbox General Tab or create a new
>>> tab in the Toolbox. In this example, the General tab is used.
>>>
>>> Step 4) Select the general tab in the Toolbox, right click and select
>>>         "Choose Items..."
>>>
>>> Step 5) Click Browse and find the location of your DLL, click OK.
>>>
>>> The component *SHOULD* appear in the toolbox General tab.
>>>
>>> o Testing
>>>
>>> Step 6) Create a new Windows Application project.
>>>
>>> Step 7) Display the form and drop the component.
>>>
>>> The component *SHOULD* appear in the COMPONENT TRAY at the bottom  of
>>> the form display.
>>>                --------------------
>>>
>>> Overall, what I found, unless I did something wrong, selecting a
>>> Windows Control Library Project did not work. This creates a UI user
>>> control. I had to create a class library then add a component to it.
>>> Simple of course, but if you never done it before, it isn't obvious.
>>>
>>> In short, IMO, there should be a new project template called:
>>>
>>>   Windows Component Library
>>>
>>> with a description
>>>
>>>   A project for creating NON-UI ToolBox components to use in Windows
>>>   applications
>>>
>>> Is there some IDE method that does this?
>>>
>>> I believe I saw convert options somewhere, don't recall where, maybe
>>> in the class explorer, that saids
>>>
>>>     Convert Class to Component ...
>>>     Convert Class to Control ...
>>>
>>> That is what give me the idea of doing the steps above because I
>>> didn't recall where these options were at.
>>>
>>> Anyway, maybe this will help the next .NET newbie because every
>>> example I found on MSDN and else where was for creating UI
>>> components. :-)
>>>
>>> Thanks for all your input.
>>>
>>> --
>>
Author
14 May 2009 1:21 AM
joecool1969
On May 13, 8:53 pm, Mike <unkn***@unknown.tv> wrote:
Show quoteHide quote
> I've been trying to create a VB.NET window control and add it to the
> toolbar where a vb.net form application can click, drag and drop into
>   his form.
>
> Been reading all the MSDN docs and can't seem to find how this is
> done. I'm  sure its very simple and  I'm over thinking something.
>
> In  VB6  it was easy because I could right click the toolbar and add
> the control.   The right click property window under VS2005 toolbar
> has a "Show Items..." but no "add control" idea. It has an Add Tab but
> no add control.
>
> Can someone steer me right here?  It will be greatly appreciated.
>

I assume the custom control has been compiled into a DLL. You may want
to create a tab just to store custom controls or not. Drag and drop
the DLL file into the tab of your choice in the toolbox.

Simple, eh?
Author
14 May 2009 1:49 AM
Mike
joecool1***@live.com wrote:
> On May 13, 8:53 pm, Mike <unkn***@unknown.tv> wrote:
>> I've been trying to create a VB.NET window control and add it to the
>> toolbar where a vb.net form application can click, drag and drop into
>> his form.
>>
>> Can someone steer me right here?  It will be greatly appreciated.
>>
>
> I assume the custom control has been compiled into a DLL. You may want
> to create a tab just to store custom controls or not. Drag and drop
> the DLL file into the tab of your choice in the toolbox.
>
> Simple, eh?

I hope it was :-)

Right. It had a General tab, so I added a Wildcat tab. From solution
explorer, I tried dragging the project name, but only took the
CustomControl1.vb file shows up as:

  -  Wildcat
     Pointer
     TEXT: full path name to file.

You mean, compile the DLL, Show all files, and drag and drop the
bin\*.dll into the custom tab?  Let  me try that....

Same thing, just shows:

    TEXT: Full path to dll file

When I bring up another test Windows Form application, I don't see see
   this the Tab.   I also tried adding a reference to the DLL.