Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Tue, 28 Feb 2006 10:05:46 -0600,    group: microsoft.public.dotnet.framework.windowsforms.designtime        back       


Problem with IDE when overriding Text property   
I noticed when overriding the Text property of the 
System.Windows.Forms.UserControl that the Form.Designer file does not 
reflect changes made via the property browser.  In other words, when you 
override the Text property and then try to change it's value at design-time, 
the value is not serialized and therefore not available at run-time.

This problem does not appear to be language specific; I've reproduced it in 
C# and in VB.  Here are examples of what I've written:

In VB:
    <System.ComponentModel.Browsable(True)> _
    Public Overrides Property Text() As String
        Get
            Return lblTitle.Text
        End Get
        Set(ByVal value As String)
            lblTitle.Text = value
        End Set
    End Property


In C#:
        [System.ComponentModel.Browsable(true)]
        public override string Text
        {
            get { return lblTitle.Text; }
            set { lblTitle.Text = value; }
        }


Can anyone explain to me what is happening and how I might correct the 
problem?
date: Tue, 28 Feb 2006 10:05:46 -0600   author:   Jason Barnett

Re: Problem with IDE when overriding Text property   
Answer posted in the "microsoft.public.dotnet.framework" newsgroup.
http://groups.google.com/group/microsoft.public.dotnet.framework/browse_thread/thread/8cff4c7e257f556e/ce992f874f7c73f5?hl=en#ce992f874f7c73f5

-- 
Tim Wilson
..NET Compact Framework MVP

"Jason Barnett"  wrote in message
news:e9PzWDIPGHA.3856@TK2MSFTNGP12.phx.gbl...
> I noticed when overriding the Text property of the
> System.Windows.Forms.UserControl that the Form.Designer file does not
> reflect changes made via the property browser.  In other words, when you
> override the Text property and then try to change it's value at
design-time,
> the value is not serialized and therefore not available at run-time.
>
> This problem does not appear to be language specific; I've reproduced it
in
> C# and in VB.  Here are examples of what I've written:
>
> In VB:
>     <System.ComponentModel.Browsable(True)> _
>     Public Overrides Property Text() As String
>         Get
>             Return lblTitle.Text
>         End Get
>         Set(ByVal value As String)
>             lblTitle.Text = value
>         End Set
>     End Property
>
>
> In C#:
>         [System.ComponentModel.Browsable(true)]
>         public override string Text
>         {
>             get { return lblTitle.Text; }
>             set { lblTitle.Text = value; }
>         }
>
>
> Can anyone explain to me what is happening and how I might correct the
> problem?
>
>
date: Tue, 28 Feb 2006 17:04:05 -0500   author:   Tim Wilson TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM

Re: Problem with IDE when overriding Text property   
Hello,
I'd the same problem as you with Compact Framework end VS 2005.

This is the solution :

Override the Text property (code should be like this one) :

    public override string Text
    {
      get
      {
        return(base.Text);
      }
      set
      {
        base.Text = value;
        this.Invalidate();

      }
    }

The right click on the usercontrol in the solution explorer, choose "View Class Diagram" and then display the class details view for the control.

In this view, you should see the "Text" property, edit the "Custom attributes" of the "Text" property.
And add the 4 lines listed below in the window appearing :
 EditorBrowsable(EditorBrowsableState.Always)
 Browsable(true)
 DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)
 Bindable(true)

Recompile the project ... and you should see teh text property !!!

---
Posted via www.DotNetSlackers.com
date: Tue, 18 Apr 2006 06:55:52 -0700   author:   Bulle

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us