StoneCodeMonkey
Well-known member
- Joined
- Apr 17, 2009
- Messages
- 56
- Programming Experience
- 5-10
I have been using app.config to store various setting for my applications in several small projects recently. I created a class that would expose the app.config values as properties. For example:
I find myself editing this class often to add new properties as required by each project. I would like to convert this class to a Component that will allow me to use a design time editor to add properties dynamically or maybe something as simple when the main application starts, instance.AddProprty(ByVal ElementName, ByVal ReturnType as Object).
How would I go about adding a property dynamically to the componet such that I can still use the instance.xxxx = abc or abc = instance.xxxx notation.
It is simple enough to create the component class: Public Class AppManager : Inherits Component.
I just don't see a method to add a property dynamically.
Best regards,
VB.NET:
Public Class ConfigManagement
Private config As System.Configuration.Configuration
Public Sub New()
config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
End Sub
Public ReadOnly Property DebugMode() As Boolean
Get
Return config.AppSettings.Settings("Debug").Value
End Get
End Property
Public ReadOnly Property AppTitle() As String
Get
Return config.AppSettings.Settings("AppTitle").Value
End Get
End Property
End Class
I find myself editing this class often to add new properties as required by each project. I would like to convert this class to a Component that will allow me to use a design time editor to add properties dynamically or maybe something as simple when the main application starts, instance.AddProprty(ByVal ElementName, ByVal ReturnType as Object).
How would I go about adding a property dynamically to the componet such that I can still use the instance.xxxx = abc or abc = instance.xxxx notation.
It is simple enough to create the component class: Public Class AppManager : Inherits Component.
I just don't see a method to add a property dynamically.
Best regards,