469,613 Members | 1,940 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

Inheriting from UserControls

I want a set of controls that all have a border, like a group box. I thought
I would create a base control containing just a group box from which my set
of controls could inherit. Assuming that this is the right approach (please
tell me if it is not), how then do I make it so that the group box cannot be
moved around on my set of controls, but is also able to act as container for
other controls?

If I leave the modifier of the group box as Friend, or Private, then the
group box appears locked on the inheriting controls, but I cannot drop new
controls onto it. If I change the modifier to Protected, Protected Friend,
or Public, then I can drop controls onto the group box, but I can also move
the group box around on the inheriting control.

Is there something else I must do?

TIA

Charles
Nov 20 '05 #1
2 1630
Hi Charles,

It maybe easier to simply inherit from GroupBox. The problem is you won't
have a designer when you write the control so you'll have to do everything
in code.

Craig VB. NET Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

--------------------
From: "Charles Law" <bl***@nowhere.com>
Subject: Inheriting from UserControls
Date: Mon, 1 Mar 2004 19:44:04 -0000
Lines: 20
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <OH**************@TK2MSFTNGP11.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: host81-132-105-130.in-addr.btopenworld.com 81.132.105.130Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXS01.phx.gbl!TK2MSFT NGXA05.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP11.phx.gblXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:185777
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

I want a set of controls that all have a border, like a group box. I thoughtI would create a base control containing just a group box from which my set
of controls could inherit. Assuming that this is the right approach (please
tell me if it is not), how then do I make it so that the group box cannot bemoved around on my set of controls, but is also able to act as container forother controls?

If I leave the modifier of the group box as Friend, or Private, then the
group box appears locked on the inheriting controls, but I cannot drop new
controls onto it. If I change the modifier to Protected, Protected Friend,
or Public, then I can drop controls onto the group box, but I can also move
the group box around on the inheriting control.

Is there something else I must do?

TIA

Charles

Nov 20 '05 #2
Hi Craig

I see what you mean. I have just tried it, but I think the absence of a
designer will be a problem. I want to be able to lay out my inheriting
control visually, rather than 'guess' the position of things in code.

It's a shame that inheriting from GroupBox doesn't give a designer inside a
group box.

Charles
"Craig Vick [MSFT]" <cr*****@online.microsoft.com> wrote in message
news:$%*****************@cpmsftngxa06.phx.gbl...
Hi Charles,

It maybe easier to simply inherit from GroupBox. The problem is you won't
have a designer when you write the control so you'll have to do everything
in code.

Craig VB. NET Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

--------------------
From: "Charles Law" <bl***@nowhere.com>
Subject: Inheriting from UserControls
Date: Mon, 1 Mar 2004 19:44:04 -0000
Lines: 20
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <OH**************@TK2MSFTNGP11.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: host81-132-105-130.in-addr.btopenworld.com 81.132.105.130
Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGXS01.phx.gbl!TK2MSFT NGXA05.phx.gbl!TK2MSFTNGP0 8.phx.gbl!TK2MSFTNGP11.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:185777
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

I want a set of controls that all have a border, like a group box. I

thought
I would create a base control containing just a group box from which my setof controls could inherit. Assuming that this is the right approach (pleasetell me if it is not), how then do I make it so that the group box cannot

be
moved around on my set of controls, but is also able to act as container

for
other controls?

If I leave the modifier of the group box as Friend, or Private, then the
group box appears locked on the inheriting controls, but I cannot drop newcontrols onto it. If I change the modifier to Protected, Protected Friend,or Public, then I can drop controls onto the group box, but I can also movethe group box around on the inheriting control.

Is there something else I must do?

TIA

Charles


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Kevin Blackwell | last post: by
4 posts views Thread by Anders K. Jacobsen [DK] | last post: by
1 post views Thread by luminousc | last post: by
3 posts views Thread by YYZ | last post: by
9 posts views Thread by Dominique | last post: by
4 posts views Thread by Nathan Sokalski | last post: by
7 posts views Thread by Nathan Sokalski | last post: by
reply views Thread by SpaceMarine | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.