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 / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

componentmodel: saving enum type to app.config

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Slawek Piotrowski - 05 Aug 2005 15:40 GMT
(using .NET Framework 1.1)

Hello,

I'm finishing work on a component that is available for users in their
visual designer. It has various properties that can be sent by users. Using
"DynamicProperties" users can set my component's properties to be saved in
their application's configuration file (to be later changed on per
installation basics).

Unfortunatelly it doesn't seem to work with properties that are
enumerations. No matter if I mark enum property with
[RecommendedAsConfigurable(true)] or not, it is still not available in
DynamicProperties (even in Advanced settings).

I've taken a look at what code is generated for string properties loaded
from configuration settings and it looks like it would be enough to replace
"(string)" with "(myenumtype)". Seems trivial but how to make code generator
do that?

I've tried to find a solution to this problem and the only thing I've found
that actually worked was switching property from enumaration to string and
implementing a special class that displays a set of options in visual
designer.

Unfortunatelly this workaround can't be called a solution as it has a
serious limitation - if user needs to change property's value at runtime, sie
needs to enter new value as a string - this doesn't work anymore:
mycomponent.myproperty = type.value;

Users need to write code like this:
mycomponent.myproperty = "value";
which looks bad, is easier to make errors and doesn't allow intellisense to
help the user.

I haven't found any other solution.

Fortunatelly the problem looks like something really common, so the solution
shouldn't be that far away.

Do you have any ideas how can I solve this problem? Could you share them?

Signature

Sławomir Piotrowski / Telsat GP
Rejestracja Czasu Pracy i Kontrola Dostępu
http://www.ewidencja-czasu-pracy.pl

Slawek Piotrowski - 08 Aug 2005 14:09 GMT
Update:

I'm fine with generating code required to read enum from app.config myself
(using CodeDom). Unfortunatelly I can't find any way to make Visual Studio
call my code to do that. In fact I can't even find a way to make Visual
Studio allow enum type being set as a dynamic property.

Signature

Sławomir Piotrowski / Telsat GP
Rejestracja Czasu Pracy i Kontrola Dostępu
http://www.ewidencja-czasu-pracy.pl

> (using .NET Framework 1.1)
>
[quoted text clipped - 37 lines]
>
> Do you have any ideas how can I solve this problem? Could you share them?

Rate this thread:







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.