T
thomasp
Using VB2005
I have a form that allows the user to set a time offset for imported
records. I am trying to save this value with My.setting so that it is
loaded each time the program is used. I was doing this with an .ini file
but thought that I should try to use this new feature. I set it up as a
application setting but soon found out this is readonly and cannot be set
while the program is running, so I changed it to a user setting. Problem
is, it will work only part of the time. The user may open the program twice
and all is fine, next time the program is open the setting will be gone.
Any suggestions?
Thanks,
Thomas
Private Sub ComboBox3_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles ComboBox3.Validating
cmdOK.Enabled = True
If IsNumeric(ComboBox3.Text) AndAlso (Val(ComboBox3.Text) >= -12
AndAlso Val(ComboBox3.Text) <= 12) Then
ErrorProvider1.SetError(Me.ComboBox3, "")
strUTAMSOffset = Trim(ComboBox3.Text.ToString)
My.Settings.UTAMSOffset = strUTAMSOffset
My.Settings.Save()
Else
ErrorProvider1.SetIconAlignment(Me.ComboBox3,
ErrorIconAlignment.MiddleLeft)
ErrorProvider1.SetError(Me.ComboBox3, "Entry must be a number
between -12 and 12.")
ComboBox3.Focus()
cmdOK.Enabled = False
End If
End Sub
I have a form that allows the user to set a time offset for imported
records. I am trying to save this value with My.setting so that it is
loaded each time the program is used. I was doing this with an .ini file
but thought that I should try to use this new feature. I set it up as a
application setting but soon found out this is readonly and cannot be set
while the program is running, so I changed it to a user setting. Problem
is, it will work only part of the time. The user may open the program twice
and all is fine, next time the program is open the setting will be gone.
Any suggestions?
Thanks,
Thomas
Private Sub ComboBox3_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles ComboBox3.Validating
cmdOK.Enabled = True
If IsNumeric(ComboBox3.Text) AndAlso (Val(ComboBox3.Text) >= -12
AndAlso Val(ComboBox3.Text) <= 12) Then
ErrorProvider1.SetError(Me.ComboBox3, "")
strUTAMSOffset = Trim(ComboBox3.Text.ToString)
My.Settings.UTAMSOffset = strUTAMSOffset
My.Settings.Save()
Else
ErrorProvider1.SetIconAlignment(Me.ComboBox3,
ErrorIconAlignment.MiddleLeft)
ErrorProvider1.SetError(Me.ComboBox3, "Entry must be a number
between -12 and 12.")
ComboBox3.Focus()
cmdOK.Enabled = False
End If
End Sub