VB 2010 - Create Custom Configuration Section Using ConfigurationSection


I am trying to create custom section in app.connfig file of my Windows Form application following instructions on this page:


but don't know how to do it.

I would like to have this in final:

      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />

Open in new window

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
                Return Me("productId")
            End Get
            Set(ByVal value As String)
                Me("productId") = value
            End Set
        End Property
    End Class
End Namespace

Open in new window

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.

Who is Participating?
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
Éric MoreauSenior .Net ConsultantCommented:
skdanAuthor Commented:
Yes, but I would like to create section, which is not a part of Users Settings section.
skdanAuthor Commented:
I will study this tutorial. I think, this is exactly what I need. Thank you very much.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.