Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ToolboxItem(False) Woes

6 views
Skip to first unread message

Shawn B.

unread,
Aug 31, 2003, 5:10:04 PM8/31/03
to
Greetings,

I have a library of many custom WebControls. I have a base class that
provides certain enhanced functionality that I inherit from into all my
controls. This means that I have to reimplement the Button or TextBox
controls because I can't multiple inherit, if I want to benefit from code
re-use, which I do. It'll be too much to maintain if I have to copy and
paste the same code and keep it in synch in 30 different controls.

The base class, I use ToolboxItem(False) attribute so it doesn't add itself
to the toolbox when one adds the assembly to the toolbox. It's not a
functional controls.

When I inherit, the class that inherits the control must be
ToolboxItem(True) or it won't appear in the toolbox. The problem is that
the designer won't show that control when there's conflicting attributes but
I don't know how to solve the problem.

BaseClass (ToolboxItem(False))
+-- SuperClass (ToolboxItem(True))

Try it and you'll see that you can't use the control. To solve the problem
I have to not specify in the base class, keep it true by default. But then
when you select the assembly it adds that class with all the others to the
toolbox. Very frustrating.

Any ideas?

I'm using VS.NET 2003.


Thanks,
Shawn


Ross Donald

unread,
Sep 2, 2003, 9:35:31 AM9/2/03
to
Hi Shawn,

If your base class is declared as MustInherit (in VB.NET) or abstract (in
C#) then it will not be shown on the Toolbox. This will fix the issue you
are talking about. It is also more inline with proper object oriented
programming as your base control must be derived by another class before it
can be used.

--
Ross Donald
Rad Software
Free Regular Expression Designer
http://www.radsoftware.com.au/web/Products/

"Shawn B." <lea...@html.com> wrote in message
news:%23tPxARA...@TK2MSFTNGP12.phx.gbl...

Shawn B.

unread,
Sep 5, 2003, 12:53:50 PM9/5/03
to
Good point, that worked. Didn't think of that one.


Thanks,
Shawn

"Ross Donald" <ro...@radsoftware.com.auNOSPAM> wrote in message
news:O7tracVc...@TK2MSFTNGP10.phx.gbl...

0 new messages