473,385 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How To: Control Container

So, here is the (back of a cigarette packet) spec for a
new UserControl I am trying to develop -

1. It needs to be a control container

2. Scroll bars should appear if any contained control is
outside the visible area

3. A navigation button should appear if any contained
control is outside the visible area

4. Clicking the button should cause a context menu to
appear offering -
Top
Bottom
Left
Right
-
Top Left
Top Right
Bottom Left
Bottom Right

5. Clicking one of the menu options should move to the
appropriate location

6. If any contained control recieves the focus, the
container should ensure that the contained control is in
the visible region, if not then it should be automatically
scrolled into the visible region.

I have written this control in VB6 and it took me a couple
of hours. In VB.Net, I can't even get the new control to
act as a container. I have tried -

Me.SetStyle(ControlStyles.ContainerControl, True)
Me.UpdateStyles()

in the .New method but it doesn't seem to make any
difference, when a control is pasted into my new control,
it doesn't end up contained (i.e. it's parent is still the
windows form rather than my new control). I have searched
the help and various web sites for an example of a
UserControl that acts as a container (and still has a
surface that I can place the scroll bars and button on) to
no avail.

Am I missing something fundamental here? I have been
writing code for 25 years (starting out on a ZX Spectrum
and moving through GW Basic, QuickBasic versions 1 through
7 and finally all the Visual basic releases) and have
never come across anything so infuriating.

I would appreciate any help that you could offer.

Cheers, Tony Harrison

Microsoft Development Environment 2002 Version 7.0.9466
Microsoft .NET Framework 1.0 Version 1.0.3705
Jul 19 '05 #1
3 4872
yup, you need to add the ParentControlDesigner attribute to your control

http://support.microsoft.com/default...b;EN-US;322222

r.

"Tony" <to***********@ashsoftware.com> wrote in message
news:1c****************************@phx.gbl...
So, here is the (back of a cigarette packet) spec for a
new UserControl I am trying to develop -

1. It needs to be a control container

2. Scroll bars should appear if any contained control is
outside the visible area

3. A navigation button should appear if any contained
control is outside the visible area

4. Clicking the button should cause a context menu to
appear offering -
Top
Bottom
Left
Right
-
Top Left
Top Right
Bottom Left
Bottom Right

5. Clicking one of the menu options should move to the
appropriate location

6. If any contained control recieves the focus, the
container should ensure that the contained control is in
the visible region, if not then it should be automatically
scrolled into the visible region.

I have written this control in VB6 and it took me a couple
of hours. In VB.Net, I can't even get the new control to
act as a container. I have tried -

Me.SetStyle(ControlStyles.ContainerControl, True)
Me.UpdateStyles()

in the .New method but it doesn't seem to make any
difference, when a control is pasted into my new control,
it doesn't end up contained (i.e. it's parent is still the
windows form rather than my new control). I have searched
the help and various web sites for an example of a
UserControl that acts as a container (and still has a
surface that I can place the scroll bars and button on) to
no avail.

Am I missing something fundamental here? I have been
writing code for 25 years (starting out on a ZX Spectrum
and moving through GW Basic, QuickBasic versions 1 through
7 and finally all the Visual basic releases) and have
never come across anything so infuriating.

I would appreciate any help that you could offer.

Cheers, Tony Harrison

Microsoft Development Environment 2002 Version 7.0.9466
Microsoft .NET Framework 1.0 Version 1.0.3705

Jul 19 '05 #2
Hi,

Tony wrote:
So, here is the (back of a cigarette packet) spec for a
new UserControl I am trying to develop -


Can you not just inherit from UserControl to start with? I believe doing so
will give you all the benefits of the UserControl, to which you can add your
own functionality. I'm assuming that this isn't what you've done because you
say you cannot get it to act as a container?

-- Pete
Jul 19 '05 #3
D'oh! Ignore me I was being dumb, that other article explains it all.

-- Pete
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gilles T. | last post by:
How I can get element ID in the edit mode of datagrid control? If I not in the edit mode, there are no problem. <asp:TemplateColumn ItemStyle-CssClass="grid_column_width_3"...
0
by: Alex | last post by:
Interested in more .NET stuff visit www.dedicatedsolutions.co.uk The DataList is not as powerful as the DataGrid. It requires more work from you since it has no default data presentation format....
2
by: tshad | last post by:
This is related to my other Hiding datalistitems problem that I can't seem to solve. I have tried different methods which all seem to work only partially. I decided to try to use a User...
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
2
by: Sam | last post by:
Please help! I want to create a user control that can act as a container for other controls (like a panel or a groupbox). The control will consist of a panel that acts as the container for...
0
by: pabloazorin | last post by:
I developed a Date Picker web control using C# and .net framework 1.1 I added my control to Visual Studio 2003 IDE toolbar. When I drag and drop my control to design web page, the control renders...
6
by: Greg | last post by:
Is there a simple way to test if a control is a container type control (e.g. groupbox, panel etc) I realise that all container controls have to by definition, have the...
4
by: Joseph Geretz | last post by:
Don't get me wrong - I'm a fan of .NET; I am enthusiastic about the richness and elegance of the environment. However, richness and elegance should be dedicated toward making development easier for...
1
by: Doogie | last post by:
Hi, I have been trying to get a checkbox added to a repeater control of mine and then try to access events of the repeater control when a user clicks the checkbox. At first, since the control is...
5
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.