That's is the function of DefaultValue or ShouldSerialize. It should not
persist "default" values. If it is removing the persistence code from the
class it is working as it should.
If it persisted values for every property there would be thousands of lines
of useless code in the InitializeComponent block.
HTH;
Eric Cadwell
http://www.origincontrols.com
Sven Meyer - 29 Apr 2004 09:01 GMT
Hi Eric
Thanks for your answer.
>If it is removing the persistence code from the
>class it is working as it should.
Thats exactly my problem. Once a value is persisted to code, it is NOT
removed when the subproperty is resetted (after saving the project).
It stays in the code and therefore after I compile the project for
example, the old value is still there (and shown again in the
propertygrid).
The Propertygrid looks like the following:
1. step: initial situation
- TestProp
Img (Kein) (i'm using a german VS.NET)
2. step: after assigning a value to Img
- TestProp
Img <some image>
This change is persisted to code. Now, I save the project (important).
3. step: reset the subproperty Img from the contextmenu
- TestProp
Img (Kein)
Looks fine in the propertygrid, but if I look at the sourcecode, the
old value is still there. It is not removed from code. i.e.
this.TestButton1.TestProp = new
...Prop((System.Drawing.Bitmap)(resources.GetObject("resource")));
The strange issue is: if the whole TestProp property is resetted from
the contextmenu, it works fine, the line is removed. only when I reset
the subproperty itself, the code isn't removed.
Sven
> That's is the function of DefaultValue or ShouldSerialize. It should not
> persist "default" values. If it is removing the persistence code from the
[quoted text clipped - 6 lines]
> Eric Cadwell
> http://www.origincontrols.com
Keith Hill - 15 Jun 2004 03:11 GMT
Did you ever figure this out? I'm having the exact same problem.
--
Keith
> Hi Eric
>
[quoted text clipped - 36 lines]
>
> Sven
Sven Meyer - 29 Apr 2004 09:01 GMT
Hi Eric
Thanks for your answer.
>If it is removing the persistence code from the
>class it is working as it should.
Thats exactly my problem. Once a value is persisted to code, it is NOT
removed when the subproperty is resetted (after saving the project).
It stays in the code and therefore after I compile the project for
example, the old value is still there (and shown again in the
propertygrid).
The Propertygrid looks like the following:
1. step: initial situation
- TestProp
Img (Kein) (i'm using a german VS.NET)
2. step: after assigning a value to Img
- TestProp
Img <some image>
This change is persisted to code. Now, I save the project (important).
3. step: reset the subproperty Img from the contextmenu
- TestProp
Img (Kein)
Looks fine in the propertygrid, but if I look at the sourcecode, the
old value is still there. It is not removed from code. i.e.
this.TestButton1.TestProp = new
...Prop((System.Drawing.Bitmap)(resources.GetObject("resource")));
The strange issue is: if the whole TestProp property is resetted from
the contextmenu, it works fine, the line is removed. only when I reset
the subproperty itself, the code isn't removed.
Sven
> That's is the function of DefaultValue or ShouldSerialize. It should not
> persist "default" values. If it is removing the persistence code from the
[quoted text clipped - 6 lines]
> Eric Cadwell
> http://www.origincontrols.com