PropertyGrid Reset Typeconverters

D

Dave Girvitz

I have a PropertyGrid (Windows Forms App) based component that uses
TypeConverters to generate ranges of acceptable values for properties. The
idea was that I could download the key/value pairs from a database and
manipulate the TypeConverters dynamically. The property grid then displays
the property with a drop down list.

It does work when I open the application for the first time. If, however, I
open the form and then open a second form and change some data; the new data
is not reflected in the drop down lists when I return to the first form.
The only way to reset the typeconverters is to close the application and
restart it.

I'm guessing, but it appears that the PropertyGrid holds some static
collection of class/properties and typeconverters. Also, it appears that it
is initialized the first time that an instance of a class is designated as a
PropertyGrid instance's SelectedObject. What I need however is the ability
to reinitialize the typeconverters when required. Does anybody know how to
do this?

Thank you,
Dave Girvitz, MCAD
 
J

Jeffrey Tan[MSFT]

Hi Dave,

I think you must save the data you have changed in the second form to the
database.
Then you should use some way to make the first form to reload the data in
the database.

Maybe you can put a "reload" button in the form which can reload the data.
Also, you can register certain message to windows to inform all the
instance of you application
to update data after your change.

Hope this helps.

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Dave Girvitz" <[email protected]>
| Subject: PropertyGrid Reset Typeconverters
| Date: Fri, 25 Jul 2003 13:49:16 -0600
| Lines: 29
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: h68-146-48-175.cg.shawcable.net 68.146.48.175
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:171900
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I have a PropertyGrid (Windows Forms App) based component that uses
| TypeConverters to generate ranges of acceptable values for properties.
The
| idea was that I could download the key/value pairs from a database and
| manipulate the TypeConverters dynamically. The property grid then
displays
| the property with a drop down list.
|
| It does work when I open the application for the first time. If,
however, I
| open the form and then open a second form and change some data; the new
data
| is not reflected in the drop down lists when I return to the first form.
| The only way to reset the typeconverters is to close the application and
| restart it.
|
| I'm guessing, but it appears that the PropertyGrid holds some static
| collection of class/properties and typeconverters. Also, it appears that
it
| is initialized the first time that an instance of a class is designated
as a
| PropertyGrid instance's SelectedObject. What I need however is the
ability
| to reinitialize the typeconverters when required. Does anybody know how
to
| do this?
|
| Thank you,
| Dave Girvitz, MCAD
|
|
| ---
| Outgoing mail is certified Virus Free.
| Checked by AVG anti-virus system (http://www.grisoft.com).
| Version: 6.0.502 / Virus Database: 300 - Release Date: 07/18/2003
|
|
|
 
J

Jeffrey Tan[MSFT]

Hi Dave,

I do not quite understand your problem, if you have time, I'd like to see
your mocking up.

Thanks

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Dave Girvitz" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: PropertyGrid Reset Typeconverters
| Date: Thu, 31 Jul 2003 11:27:58 -0600
| Lines: 103
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: h68-146-48-175.cg.shawcable.net 68.146.48.175
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:173341
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Dear Jeffery,
| This does not appear to be the problem. The actual data for the
| TypeConverter is held by a separate class that has a static dataset as
| property. I know the dataset is being updated properly. My actual usage
is
| scheduler. The form in question holds 2 property grids, represent a 2 day
| span. The selected object has 24 properties (the hours of the day) that
use
| the my TypeConverter. When I load an object into each of the property
grid,
| I know that the constructor of the typeconverter fires 24 times. Nothing
I
| do can get the constructor to refire. This is why I think the initiation
| process is handled by private static methods that somehow access
information
| about a class. It also appears that this information is stored in some
sort
| of collection and is never updated. If you like, I can do a mock up of the
| code to illustrate the problem.
|
| Dave
|
| | >
| > Hi Dave,
| >
| > I think you must save the data you have changed in the second form to
the
| > database.
| > Then you should use some way to make the first form to reload the data
in
| > the database.
| >
| > Maybe you can put a "reload" button in the form which can reload the
data.
| > Also, you can register certain message to windows to inform all the
| > instance of you application
| > to update data after your change.
| >
| > Hope this helps.
| >
| > Jeffrey Tan
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
| > --------------------
| > | From: "Dave Girvitz" <[email protected]>
| > | Subject: PropertyGrid Reset Typeconverters
| > | Date: Fri, 25 Jul 2003 13:49:16 -0600
| > | Lines: 29
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | NNTP-Posting-Host: h68-146-48-175.cg.shawcable.net 68.146.48.175
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.languages.csharp:171900
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > |
| > | I have a PropertyGrid (Windows Forms App) based component that uses
| > | TypeConverters to generate ranges of acceptable values for properties.
| > The
| > | idea was that I could download the key/value pairs from a database and
| > | manipulate the TypeConverters dynamically. The property grid then
| > displays
| > | the property with a drop down list.
| > |
| > | It does work when I open the application for the first time. If,
| > however, I
| > | open the form and then open a second form and change some data; the
new
| > data
| > | is not reflected in the drop down lists when I return to the first
form.
| > | The only way to reset the typeconverters is to close the application
and
| > | restart it.
| > |
| > | I'm guessing, but it appears that the PropertyGrid holds some static
| > | collection of class/properties and typeconverters. Also, it appears
| that
| > it
| > | is initialized the first time that an instance of a class is
designated
| > as a
| > | PropertyGrid instance's SelectedObject. What I need however is the
| > ability
| > | to reinitialize the typeconverters when required. Does anybody know
how
| > to
| > | do this?
| > |
| > | Thank you,
| > | Dave Girvitz, MCAD
| > |
| > |
| > | ---
| > | Outgoing mail is certified Virus Free.
| > | Checked by AVG anti-virus system (http://www.grisoft.com).
| > | Version: 6.0.502 / Virus Database: 300 - Release Date: 07/18/2003
| > |
| > |
| > |
| >
|
|
| ---
| Outgoing mail is certified Virus Free.
| Checked by AVG anti-virus system (http://www.grisoft.com).
| Version: 6.0.502 / Virus Database: 300 - Release Date: 07/18/2003
|
|
|
 
D

Dmitriy Lapshin [C# / .NET MVP]

Jeffrey, Dave,

The problem seems to be in that the TypeConverters have no chance to find
out when they should refresh their lists of valid property values. I think a
some notification mechanism should be introduced (kind of the Observer GoF
pattern, emplpoying standard framework events) and when the user modifes
data in the second form, an event is raised and all interested subscribers
(that is, TypeConverter instances) refresh their data.

I unfortunately cannot advise anything about the PropertyGrid caching, as I
have never dealt with this control. I would suggest though looking for an
article in the May or June issue of MSDN Magazine where righ design features
for custom user controls are described. I think Dave might find some useful
info about behind-the-scenes details of the TypeConverters and the property
editor.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top