|
-
March 14th, 2003, 06:58 PM
#1
UserControl with dynamic child windows
Hi I'm building a user control that has dynamic child windows, depending on the selection of a property the control will contain a combobox, listbox or radio buttons.
When the control is first displayed with its intial set of child controls, these child controls are not accessible i.e. you can't click on them etc.
However, when I change a property that initiates the creation of child controls, the new controls I create are accessible i.e. for a listbox you can select an item.
Can anybody point to some information on either how to make the child controls always useable or how to create child controls that are not useable.
-
March 17th, 2003, 02:54 PM
#2
hi
when you are in design mode and designing UI components for Usercontrol then you can change the behaviour of UserControl but when you instantiate it somewhere else that whole usercontrol acts as a single control so it will have the events derived etc...
so if you want inner controls to have events or message pop-ups etc you need to control the UserControl program itself.
Paresh
- Software Architect
-
March 18th, 2003, 05:49 AM
#3
ChildControls
When a property changes I excute code similar to the following.
this.SuspendLayout();
this.Controls.Clear();
ComboBox comboBox = new ComboBox();
comboBox .Dock = System.Windows.Forms.DockStyle.Fill;
comboBox .Name = "comboBox";
comboBox .Size = new System.Drawing.Size(176, 21);
comboBox .DropDownStyle = ComboBoxStyle.DropDownList;
this.Controls.Add(comboBox);
this.ResumeLayout(false);
The comboBox created this way is not in designmode i.e. it isuseable you can make the list drp down, change the selected item etc. I know there must be some construction process inside VS.Net that create a class that implements ISite and associates with the control but I can't find anynthing about this process.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|