By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,388 Members | 1,186 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,388 IT Pros & Developers. It's quick & easy.

my.settings help

P: n/a

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

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies

P: n/a
If the Application Settings are readonly, what is the value in using them...I
would think that you could do just as well and as easy to hard code settings
as constants in an application. Am I missing something?
--
Dennis in Houston
"th*****@msala.net" wrote:

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

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access

Nov 21 '05 #2

P: n/a
y not just go old school and use an INI file that can edited even during the
program? thats what i use for my programs and it works great
Nov 21 '05 #3

P: n/a

I was using an .ini file and may go back to it. I just thought this was
suppose to be the new and better way. Everything I read says .ini file are
a thing of the past, but nobody gives a good replacement for them.

Thomas

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #4

P: n/a
th*****@msala.net wrote in
news:42***********************@news.newsdemon.com:
I was using an .ini file and may go back to it. I just thought this
was suppose to be the new and better way. Everything I read says .ini
file are a thing of the past, but nobody gives a good replacement for
them.


Here is a good replacement as well as a discussion of the INI, registry etc and why not to use them:
http://www.codeproject.com/dotnet/XMLSettingsFile.asp
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.