应用案例1,实现一个简单的列表配置功能,非常简单实用,界面如图:

完整代码:
Private Sub FMStopReasonOptionsConfig_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        loadData()
    End Sub


    Private Sub loadData()
        Dim pList As StringCollection = My.Settings.stopReason
        For Each p1 As String In pList
            DataGridViewX1.Rows.Add(p1)     '手动添加数据'
        Next
    End Sub


    Private Sub xSave_Click(sender As System.Object, e As System.EventArgs) Handles xSave.Click
        Try
            xSave.Enabled = False
            Application.DoEvents()
            Dim pAppConfig As New ConfigProxy  '保存到配置文件'
            Dim pValue As New StringCollection
            For Each p1 As DataGridViewRow In DataGridViewX1.Rows
                If (p1.IsNewRow = False) Then
                    pValue.Add(Convert.ToString(p1.Cells(0).Value).Trim())
                End If
            Next
            pAppConfig.setApplicationSettingValue("stopReason", pValue)
            My.Settings.Reload()
        Catch ex As Exception


        Finally
            xSave.Enabled = True
        End Try
    End Sub


    Private Sub xClose_Click(sender As System.Object, e As System.EventArgs) Handles xClose.Click
        Me.DialogResult = Windows.Forms.DialogResult.OK
    End Sub