Adding component to toolbox

A

Amin Sobati

Hi,
I have added a component class that inherits System.windows.Forms.TextBox.
This component is in the same project as my windows application
(executable).
I could instantiate it and add to form's controls collection but I want to
know that if it is possible to add it to the toolbox like if this component
was in separate project in this solution.
Thanks in advance.
Amin
 
M

Mohamoss

Hi Amin
yes you still can use it as long as you can add reference to in the
project you are working with . In your case for example (where it is in the
same solution as the other project), you add reference to if by selecting
the "existing project tab" of the add reference three tabs, then you
select the project that has your component.
if your component however is not in the same solution you need to locate
the component assembly and then add its reference to the project that will
use the control . One thing you can do is to build the assembly of the
control with a strong name then use the global assembly utility to install
it in your in the GAC . then when you create a new project that you want to
use your component in . you just add reference to the component assembly
that will now you can find in the global assembly tab

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 
A

Amin Sobati

Hi Mohamed,
My solution has one project. The component and the consumer form are in the
same project. My component is something like this:

Public Class Test
Inherits System.Windows.Form.Control
End Class

In my form, I create a new instance of 'Test' programmatically and add it to
form's controls collection. But I want to have this control (component) in
the toolbox.
Thanks,
Amin
 
C

Chris Dunaway

form's controls collection. But I want to have this control (component) in
the toolbox.

Right click on the toolbox and choose Add/Remove components. Then browse
to your .dll and it will appear in the toolbox
--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top