C# newbie question

  • Thread starter Thread starter Herve Bocuse
  • Start date Start date
H

Herve Bocuse

Hi,

I have written a mini custom control in C#. In my assembly, there are 2
controls at the same level in the namespace hierarchy. The problem is that
when I add the dll to the toolbox in visual studio, the entry in the toolbox
takes the name of one of the 2 controls, and not the one I would like. How
to control that ? Is there an attribute I can set or ?

Thank you

Herve
 
Hi Herve,

You can use namespace aliases and use that instead.

using System.Web.UI.WebControls;
using System.Windows.Forms;
using WebTextBox = System.Web.UI.WebControls.TextBox;
using WinTextBox = System.Windows.Forms.TextBox;

Then simply use WebTextBox and WinTextBox instead of TextBox.
 
To be more precise, I discovered that my two controls are in fact added to
the toolbox, each with their respective class name.
What I would like is to see only one. The second one is private. I tried to
add the internal modifier to the class but still the toolbox takes it. How
to avoid that a class derived from System.Windows.Forms.Control be seen by
the toolbox when it loads the assembly ?

Thank you

Herve
 

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

Back
Top