473,378 Members | 1,543 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

my.settings help


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
4 1695
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
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

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Anthony Nystrom | last post by:
I need to within code control some printer settings before raising the print dialog... I need to set some properties for the printer such as "The Printer to Print too", Page settings such as paper...
4
by: Sai | last post by:
Hi, I am using VSTO 2005 Beta for building an excel application. I added application configuration file to the project (app.config) and it has the following section in it. <configuration>...
1
by: Cristian | last post by:
Hi I have some trouble (on only one developer computer) with the application settings functions... I have posted to the Microsoft.Public.vstudio.setup group but they couldn't help me and asked...
10
by: Dan | last post by:
I use the settings grid to create a setting named "ServerName". Now i want to retrieve it in code and i can't figure out how. This should be incredibly obvious but i cant get it. I have tried...
2
by: MacKris | last post by:
Hi, I'm a chemist trying to use the python script GaussSum.py with gnuplot for creating dataplots, and need some help. Whenever I try to produce a plot from the GaussSum GUI I get the error sh:...
3
by: Jon Slaughter | last post by:
I wrote an app that needed to save settings such as colors, fonts, etc... after hours of trying to use ConfigurationManager and AppSettings along with a few other things I finally found that I...
5
by: Andy | last post by:
I need to write a VB.NET WinForms app. For this purpose I need to keep some settings of the application, like many other Windows applications do. The most obvious solution is to store settings in...
2
by: =?Utf-8?B?QWFyb24=?= | last post by:
I am trying to create dynamic settings in a .NET 2.0 C# application. I need to be able to store settings on the user, but I do not know how many settings are necessary at design time because the...
8
by: Clarks Computing | last post by:
Hi all, Question regarding the settings feature in Visual C# 2008. Let's say I create a user setting called TextEditor in the settings designer. I realize that I can type a string value such...
7
by: Just_a_fan | last post by:
I save some data to an array in my program. I can reopen the setting screen and see that the data is, in fact, in the array. I then do a lot of these: My.Settings.Brkr1 = BreakerAmps(1)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.