Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Saving my.settings variables

$
0
0
Hi guys having a problem when I run the following code the my.settings variable is not saved? any ideas. To give you an idea of what I am trying to accomplish here is each remote has a unique ID as integer eg 1 - 25 if the end user want to move it to a new location say it was unit 1 now they want it to be unit 9 I am trying to change unit 1 to unit nine each unit and ID number is listed in my.settings to be updated. Eg my.settings.unit1 id = 1
 Public Sub ChangeRemoteID(ByVal NewPressName As String, ByVal RemoteNumber As Integer)
        Try
            'If Tset not used the my.setting never displays anything.
            Dim Tset As Integer = My.Settings.Press_1
            For Each value As Configuration.SettingsPropertyValue In My.Settings.PropertyValues
                If value.Name = NewPressName Then
                    My.Settings.PropertyValues(value.Name).PropertyValue = RemoteNumber
                    frmOptions.txtRemoteIDName.Text = My.Settings.PropertyValues(value.Name).Name
                    frmOptions.txtRemoteID.Text = CStr(My.Settings.PropertyValues(value.Name).PropertyValue.ToString)
                    My.Settings.Save()
                End If
            Next
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>