skdan
asked on
VB 2010 - Create Custom Configuration Section Using ConfigurationSection
Hi,
I am trying to create custom section in app.connfig file of my Windows Form application following instructions on this page:
http://msdn.microsoft.com/en-us/library/2tw134k3.aspx
but don't know how to do it.
I would like to have this in final:
Until now I have this code:
How can I store a value to key "ProductID" and save to app.config file?
I know, there are other possibilities how to store user settings, but I would like to store it in my custom section.
Thanks.
I am trying to create custom section in app.connfig file of my Windows Form application following instructions on this page:
http://msdn.microsoft.com/en-us/library/2tw134k3.aspx
but don't know how to do it.
I would like to have this in final:
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
</startup>
<productIdGroup>
<ProductID="AAAAA-BBBBB"/>
</productIdGroup>
</configuration>
Until now I have this code:
Imports System.Configuration
Namespace TestSection
Class CustomConfigSection
Inherits ConfigurationSection
' Create a "productId" element.
<ConfigurationProperty("productId")> _
Public Property ProductID() As String
Get
Return Me("productId")
End Get
Set(ByVal value As String)
Me("productId") = value
End Set
End Property
End Class
End Namespace
How can I store a value to key "ProductID" and save to app.config file?
I know, there are other possibilities how to store user settings, but I would like to store it in my custom section.
Thanks.
have you checked http://emoreau.com/Entries/Articles/2007/03/AppSettings-revisited.aspx?
ASKER
Yes, but I would like to create section, which is not a part of Users Settings section.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will study this tutorial. I think, this is exactly what I need. Thank you very much.