# Visual Basic > Visual Basic .NET >  Export My.Settings not working

## JRDumont

Hello,

I would like to export my.settings to a file that another user can use to import.

I have found various codes on many forums but all create an empty file. I have been struggling with this for days and I would appreciate any assistance.

I am using Visual Studio Community 2019 and below is my code.

Imports System.IO
Imports System.Xml
Imports System.Configuration

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim sDialog As New SaveFileDialog()
        sDialog.DefaultExt = ".AppSettings"
        sDialog.Filter = "Application Settings (*.AppSettings)|*AppSettings"

        If sDialog.ShowDialog() = DialogResult.OK Then

            Using sWriter As New StreamWriter(sDialog.FileName)

                For Each setting As Configuration.SettingsPropertyValue In My.Settings.PropertyValues

                    sWriter.WriteLine(setting.Name & "," & setting.PropertyValue.ToString())

                Next

            End Using

            My.Settings.Save()
            MessageBox.Show("Settings has been saved to the specified file", "Export", MessageBoxButtons.OK, MessageBoxIcon.Information)

        End If

    End Sub

----------


## dbasnett

This will iterate My.Settings



```
        For Each v As System.Configuration.SettingsProperty In My.Settings.Properties
            Dim s As String = String.Format("{1}{0}{2}{0}{3}",
                                            ControlChars.Tab,
                                            v.Name,
                                            My.Settings.Item(v.Name),
                                            v.PropertyType)
        Next
```

----------

