Windows Form PropertyGrid dropdown value - moni

23-Jul-07 10:07:31
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!
reply
 
 

Windows Form PropertyGrid dropdown value - Bob Powell [MVP]

26-Jul-07 05:25:39
it's not recommended practice AFAIK but you could implement you
TypeConverter as a singleton with a couple of constructors ensuring that
the first time you use it you pass in the connection string.

TypeConverters are usually instantiated, used and killed really quickly.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
reply
 

Windows Form PropertyGrid dropdown value - Robbe Morris - [MVP] C#

19-Aug-07 08:12:24
You may want to take the approach listed
in the article of my signature.

--
Robbe Morris
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorials/aspnet/270e9432-d236-47e7-b1af-5cd3abe27a75/net-propertygrid-control.aspx
reply
 
Is there any way to prevent ListBox smooth scrolling?
promotion
Silverlight    WPF    WCF    WWF    LINQ   
JavaScript    AJAX    ASP.NET    XAML   
C#    VB.NET    VB 6.0    GDI+    IIS    XML   
.NET Generics    Anonymous Methods    Delegate   
Visual Studio .NET    Expression Blend    Virus   
Windows Vista    Windows XP    Windows Update   
Windows 2003 Server    Windows 2008 Server   
SQL Server    Microsoft Excel    Microsoft Word   
SharePoint    BizTalk    Virtual Earth   
.NET Compact Framework    Web Service   

"Everything" RSS / ATOM Feed Parser
How to send and receive messages through message queuing in .Net
How to Read text file as database
SQL Server 2005 Paging Performance Tip
Display code of web page.
Fully Scalable Excel File Importer class for .net using Microsoft Jet driver
Generic Chart Color Manager class that can be used for any charts
Helper class to style the infragistics wingrid
Using Reflection to detemine as Assembly Info in and out.
Helper class to play with Window (Owners and position)
Resolving displayname from the culture using the XmlLanguage and LanguageSpecificStringDictionary class