Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

Incorrect InitializeComponent/.RESX Code Serialization

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sean J Donovan - 15 Sep 2004 15:53 GMT
When you have a control, and Localizable = FALSE, all child controls
serialize into the InitializeComponent method.  There are some
exceptions, eg. Images have their value written into the .resx file.

Eg.    this.label1.Location = new System.Drawing.Point(104, 64);
    this.label1.Name = "label1";
    this.label1.TabIndex = 0;
    this.label1.Text = "Hello";

If you have a control that has Localizable = TRUE, when all child
controls are code-serialized, the actual values are typically written to
the .resx file.

Eg.    this.label1.AccessibleDescription =
resources.GetString("label1.AccessibleDescription");
            this.label1.AccessibleName =
resources.GetString("label1.AccessibleName");
            this.label1.Anchor =
((System.Windows.Forms.AnchorStyles)(resources.GetObject("label1.Anchor")));

PROBLEM #1:

However, we have a case where the Localizable = FALSE, and the
properties are still in the .resx, IMHO, they shouldn't be, and it's a
bug.  Has anyone else seen this?

Specifcally, we have a enum property, defined as:

    /// <summary>
    /// GET/SET the button's style.
    /// </summary>
    [Category("Behavior")]
    [Description("Indicates the button's style.")]
    [DefaultValue(ButtonStyle.Simple)]
    public ButtonStyle ButtonActionStyle

Even on parent controls that don't have Localizable=TRUE, the enum still
serializes to the .resx:

    this._doneButton.ButtonActionStyle =
((Summit.Framework.View.ButtonStyle)(resources.GetObject("_doneButton.ButtonActionStyle")));

This just **shouldn't** be happening.

It becomes a problem, in that we start seeing lots of partial-bind
errors at runtime.

PROBLEM #2:

There is another related problem.  We've found that you can't have an
enum defined in a Control based class and have it reliably serialize.  I
can provide more information if needed.

Sean
Sijin Joseph - 16 Sep 2004 12:51 GMT
Check out this link
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/c
ustcodegen.asp


and also these for related info
http://msdn.microsoft.com/msdnmag/issues/03/04/Design-TimeControls/default.aspx
http://msdn.microsoft.com/msdnmag/issues/03/05/Design-TimeControls/default.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/v
snetpropbrow.asp


Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

> When you have a control, and Localizable = FALSE, all child controls
> serialize into the InitializeComponent method.  There are some
[quoted text clipped - 50 lines]
>
> Sean
Sean J Donovan - 16 Sep 2004 15:34 GMT
Thanks, that's only reference though.
It doesn't answer the question.

:-(

Sean

> Check out this link
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/c
ustcodegen.asp
 
[quoted text clipped - 64 lines]
>>
>> Sean

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.