How do I iterate My.Settings?

I'm developing an app using VB 2008.

I'd like to save each of 'my.settings' to a text file, so that a users 'my.settings' can be exported to another users machine.

I thought it would be easy to iterate each setting, write the current setting name and value to a simple text file and then read 'em back in a similar fashion.

I can't see a way. I don't need to know about the streamwriter / reading / writing text files, just how to iterate my.settings (if that is possible). there a better way of doing this?
Who is Participating?
Bob LearnedConnect With a Mentor Commented:
Maybe this might help:

Imports System.Configuration
Public Class ConnectionStringHelper
    Public Shared Sub ChangeConnectionString(ByVal key As String, ByVal originalServer As String, ByVal newServer As String)
        For Each [property] As SettingsProperty In My.MySettings.Default.Properties
            Dim name As String = [property].Name
            If name = key Then
                Dim connectionString As String = My.MySettings.Default.Item(name)
                My.MySettings.Default.Item(name) = connectionString.Replace(originalServer, newServer)
                Exit For
            End If
    End Sub
End Class

Open in new window

I think you could use the app.config file. You can replicate the app.config file and customise it for each user.
DavidRothanAuthor Commented:
Thanks 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.