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 / Languages / C# / July 2007

Tip: Looking for answers? Try searching our database.

Derived class of StringCOnverter for dynamic propertygrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
moni - 20 Jul 2007 19:48 GMT
Hi,

I am trying to use, public class FileNameConverter : StringConverter
for creating a dropdown list within my dynamic property grid. Thus I
have the methods GetStandardValuesSupported, GetStandardValues, and
GetStandardValuesExclusive.

My problem is , that my GetStandardValues, needs to get values from a
database, whose name I need to pass from another class, how do I go
about doing that??

I would also need to pass 2 other parameters. And I am never calling
the class by its constructor.
The only time the class name gets passed is like this:

myProp = new PropertySpec(attribute, typeof(string), category,
description, valueofattribute,
typeof(System.Drawing.Design.UITypeEditor),
typeof(FileNameConverter));

where PropertySpec is my dynamic propertygrid class.

Please help.

Thanks alot!
Marc Gravell - 20 Jul 2007 23:15 GMT
At /best/, you have a context (ITypeDescriptorContext) instance
available to you. This gives you access to the containing instance
(Component) and property. For complex scenarios, the trick is to make
your converter be able to read any values it needs from the containing
instance. You can cast to this - if it isn't provided, or isn't
something you expect, then fail safe.

As a side node, I would have thought the popup approach might have
worked better for this type of thing...

Marc

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.