Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Designer serialization
Message
From
29/01/2007 06:54:36
 
 
To
28/01/2007 05:04:31
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01189851
Message ID:
01189997
Views:
5
>Hi,
>
>>>>this.MyControl.MyFormCaption = this.Text;
>Let say I want to always set current form.text to myControl.MyFormCaption. How could I do this ?

You want the form caption to be set at design time when the control is dropped onto the surface? Maybe something like:
    public class TestControl : Button
    {
        private string MyFormCaption = "Hello World";

        protected override void InitLayout()
        {
            base.InitLayout();
            Control o = this;
            while (!(o is System.Windows.Forms.Form))
            {
                o = (Control) o.GetContainerControl();
            }
            o.Text = this.MyFormCaption;
        }
    }
You'd need a safer way of detecting a containing form though....
>
>Also, myControl could be dropped to user control. In this case, I would like to
>
>this.MyControl.MyFormCaption = this.ParentForm.Text; //whereby this -> usercontrol
Don't see how you can achieve that - when you add the control to the usercontrol the usercontrol won't be sited on a form. You'd probably need to build the above type logic into the usercontrol as well....
Previous
Reply
Map
View

Click here to load this message in the networking platform