473,568 Members | 2,850 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Con trolStyles.Cont ainerControl, 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 4892
yup, you need to add the ParentControlDe signer 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(Con trolStyles.Cont ainerControl, 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
2322
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" ItemStyle-HorizontalAlign="center" ItemStyle-VerticalAlign="top"> <ItemTemplate><%# CType(Container.DataItem("DateStatut"),DateTime).ToString("yyyy-MM-dd")...
0
3092
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. However, the DataGrid begins to get very cumbersome as the number of columns of data you present increases. Anything more than half a dozen columns...
2
3217
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 Control (which I'm sure is not done correctly) and get errors as I try to execute it. What I want to do is take all the data from between the...
1
6401
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 binding it to a repeater control. This repeater control has multiple text boxes and buttons. Can you please tell me how can i do paging in this case ?...
2
9764
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 external controls plus some other stuff. I hoped that all I needed to do would be to implement System.ComponentModel.IContainer,
0
1595
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 correctly. If I change to HTML the generated html is <cc1:IT24DateTime id="IT24DateTime1" runat="server" Type="Date"></cc1:IT24DateTime> .......
6
3225
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 System.ComponentModel.DesignerAttribute. If there is an easy way to query whether a control has this attribute, this may well be the way forward. I'm not sure how to do this....
4
4464
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 developers, not more difficult. In many ways this goal is achieved. However, I've run up against one particular area of development, where what...
1
1837
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 tied to xsl, I added the checkbox there. That works fine, but I cannot get any information about the checkbox (i.e. checked, unchecked, etc) when I...
5
4095
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 to wrap the control in the proper control type - which is also a container. At design time I want to be able to turn this : <my:container>...
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7660
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6275
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.