473,386 Members | 1,708 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,386 software developers and data experts.

Design/Run Time User Control Container

This may be the wrong newsgroup for this question. I'm
trying to develop a container control inherited from a
panel that I can 'Roll Up' and 'Roll down' on a button
click. The component is to be available from the
toolbox. The first time I dragged the control from the
toolbox onto a form and added other toolbox components to
it in design mode, it obviously wasn't a container, the
other components were not associated with my control. I
found a KB article, 813450, which told me how to rectify
this, which mad my component a container at design time.
The problem now is that at run time the component is not
a container, when I roll it up, the components that I'd
dropped onto it at design time are left behind on the
main form. Anyone know what I'm doing wrong? Thanks.
Jul 21 '05 #1
3 4975
Look in the InitializeComponent block of your form and see if the child
controls are added to the form's Controls collection.

They should be added to the container's Controls collection.

Here's a sample control that sounds similar in nature to yours:
http://www.codeproject.com/cs/miscctrl/xpgroupbox.asp
HTH;
Eric Cadwell
http://www.origincontrols.com
Jul 21 '05 #2
Hi Eric

Yes, the controls have been added to the component's
control collection in the InitializeComponent code block,
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.lblCaption);
this.panel1.Controls.Add(this.pbxIcon);
this.panel1.Controls.Add(this.dividerPanel1);
and it still doesn't work, the dropped controls are there
in the component at design time, I can move the component
around on my test form and they all move together but
they're behind my component's panel ant run time.

I'll have a look at the CodeCentral example you mentioned
and see if that helps.

Thanks again

Nick
Jul 21 '05 #3
panel1 is the instance name of your custom container control?

Try moving the container after you roll it up. Or change the backColor of
the container so that you can see it against the background of the form.
Your roll up code may not be doing what you expected.

[Designer(typeof(ParentControlDesigner))]
public class UserControl4 : System.Windows.Forms.UserControl
{

public void RollUp()
{
this.Height = 24;
}

public void RollDown()
{
this.Height = 240;
}
}

HTH;
Eric Cadwell
http://www.origincontrols.com
Jul 21 '05 #4

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

Similar topics

2
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx....
5
by: Guy | last post by:
Guys Hope someone can help me! I'm having real problems getting properties I type against a control I have written at design time I have written a control by inheriting from the Button control....
1
by: rkbnair | last post by:
Is it possible to define the <ItemTemplate> and <EditItemTemplate> in DataGrid programitically at run-time? The sample definition is as follows: ...
17
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but...
12
by: Raed Sawalha | last post by:
I have the following table which i can not switcha to design view error message said Could not open in Design view. Quote values differently inside a '<% ...."value"... %>' block. and the...
1
by: PJ6 | last post by:
I have a simple container that I want to be able to use at design-time - as in, be able to drag a control into it and drop it in. I already went through of some problems in WinForms that this kind...
3
by: Nick Moore | last post by:
This may be the wrong newsgroup for this question. I'm trying to develop a container control inherited from a panel that I can 'Roll Up' and 'Roll down' on a button click. The component is to be...
8
by: | last post by:
I'm looking for some design guidance on a collection of projects I'm working on. The project involves a bunch of websites constructed out of a collection of user controls. Different user...
10
by: Allan Ebdrup | last post by:
I have a custom server web control that inserts another custom web server control in a templated child control (a wisard that inserts a header in its wizardstep) Now after switching to design view...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.