473,320 Members | 1,820 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,320 software developers and data experts.

Dynamic Default Settings in My.Settings

AGP
VB.NET 2005
I've been working extensively with saving and loading my settings via the
My.Settings class. its worked out great except that i cant figure out how to
set a default setting that is dynamic. That is to say, the default property
changes per user or per machine. As an example, and this is only an example,
the default setting for the center of the screen. In the IDE I can set the
parameter as

ScreenCenter | System.Drawing.Point | User | "0,0"

the default here being 0,0 as i cant make that value dyanmic in the IDE.
Once the user has used the program and then closed then the actual value
gets updated and the default is no longer used. Is there a way to override
the deafult value with a dynamic value that is determined on startup. I have
more settings like this that need a default value to be determined
dynamically. In VB6 I could call the INI API and give it a default value
that could be dynamically determined. i was hoping there was also a
mechanism like this in VB.NET.

tia

AGP
Sep 3 '08 #1
6 4466
On Sep 3, 7:26*am, "AGP" <sindizzy....@softhome.netwrote:
VB.NET 2005
I've been working extensively with saving and loading my settings via the
My.Settings class. its worked out great except that i cant figure out howto
set a default setting that is dynamic. That is to say, the default property
changes per user or per machine. As an example, and this is only an example,
the default setting for the center of the screen. In the IDE I can set the
parameter as

ScreenCenter *| * System.Drawing.Point * | * User * * | * "0,0"

the default here being 0,0 as i cant make that value dyanmic in the IDE.
Once the user has used the program and then closed then the actual value
gets updated and the default is no longer used. Is there a way to override
the deafult value with a dynamic value that is determined on startup. I have
more settings like this that need a default value to be determined
dynamically. In VB6 I could call the INI API and give it a default value
that could be dynamically determined. i was hoping there was also a
mechanism like this in VB.NET.

tia

AGP
Are you meaning resetting settings to initial version or reloading
settings to most recently saved version?

Here is a good insight from page 4 from article:
http://www.devcity.net/Articles/281/4/article.aspx

And My.Settings has "Reset" and "Reload" methods:
http://msdn.microsoft.com/en-us/libr...13(VS.80).aspx

Hope this helps,

Onur Guzel
Sep 3 '08 #2
AGP

"kimiraikkonen" <ki*************@gmail.comwrote in message
news:0b**********************************@l42g2000 hsc.googlegroups.com...
On Sep 3, 7:26 am, "AGP" <sindizzy....@softhome.netwrote:
VB.NET 2005
I've been working extensively with saving and loading my settings via the
My.Settings class. its worked out great except that i cant figure out how
to
set a default setting that is dynamic. That is to say, the default
property
changes per user or per machine. As an example, and this is only an
example,
the default setting for the center of the screen. In the IDE I can set the
parameter as

ScreenCenter | System.Drawing.Point | User | "0,0"

the default here being 0,0 as i cant make that value dyanmic in the IDE.
Once the user has used the program and then closed then the actual value
gets updated and the default is no longer used. Is there a way to override
the deafult value with a dynamic value that is determined on startup. I
have
more settings like this that need a default value to be determined
dynamically. In VB6 I could call the INI API and give it a default value
that could be dynamically determined. i was hoping there was also a
mechanism like this in VB.NET.

tia

AGP
Are you meaning resetting settings to initial version or reloading
settings to most recently saved version?

Here is a good insight from page 4 from article:
http://www.devcity.net/Articles/281/4/article.aspx

And My.Settings has "Reset" and "Reload" methods:
http://msdn.microsoft.com/en-us/libr...13(VS.80).aspx

Hope this helps,

Onur Guzel
>>
no i dont mean that. I mean what i stated...the default value for a setting
could be dynamic depending on the user. i know how to setup the settings but
the first time the user uses the program the default setting is based on
their computer, their screen, their user name, their OS, etc. The default is
dynamic depending on the user.

AGP
Sep 4 '08 #3
AGP wrote:
>
no i dont mean that. I mean what i stated...the default value for a
setting could be dynamic depending on the user. i know how to setup
the settings but the first time the user uses the program the default
setting is based on their computer, their screen, their user name,
their OS, etc. The default is dynamic depending on the user.
I would claim that is not really a default anymore. But that's just semantics.

Make a setting called "Initialized" which has a default (a real default) of
False. Check for that first. If it is false, then calculate and set all the
other settings, effectively ignoring their dummy default values. Then set
Initialized to True, and carry on.
Sep 4 '08 #4
AGP

"Steve Gerrard" <my********@comcast.netwrote in message
news:9p******************************@comcast.com. ..
AGP wrote:
>>
no i dont mean that. I mean what i stated...the default value for a
setting could be dynamic depending on the user. i know how to setup
the settings but the first time the user uses the program the default
setting is based on their computer, their screen, their user name,
their OS, etc. The default is dynamic depending on the user.

I would claim that is not really a default anymore. But that's just
semantics.

Make a setting called "Initialized" which has a default (a real default)
of False. Check for that first. If it is false, then calculate and set all
the other settings, effectively ignoring their dummy default values. Then
set Initialized to True, and carry on.

ok but how does one go about using the same My.Settings class to do that. My
whole idea is to present the user with default properties by using the
My.Settings class. The screen was one example but lets say i would like him
to enter his user name and the default is his logon name and he could change
that at app startup. This is only an example but if i want to continue using
the My.Settings class then how would i dynamically change the default. Again
the INI API has a default that you can dynamically change and all im looking
for is a similar mechanism.

AGP
Sep 4 '08 #5
AGP wrote:
>
ok but how does one go about using the same My.Settings class to do
that. My whole idea is to present the user with default properties by
using the My.Settings class. The screen was one example but lets say
i would like him to enter his user name and the default is his logon
name and he could change that at app startup. This is only an example
but if i want to continue using the My.Settings class then how would
i dynamically change the default. Again the INI API has a default
that you can dynamically change and all im looking for is a similar
mechanism.
First code that runs goes

If Not My.Settings.Initialized Then
My.Settings.UserName = My.User.Name
' set any other "dynamic defaults" here...
My.Settings.Initialized = True
My.Settings.Save()
End If

After that one time, the settings will behave as usual.
Sep 4 '08 #6
AGP

"Steve Gerrard" <my********@comcast.netwrote in message
news:nf******************************@comcast.com. ..
AGP wrote:
>>
ok but how does one go about using the same My.Settings class to do
that. My whole idea is to present the user with default properties by
using the My.Settings class. The screen was one example but lets say
i would like him to enter his user name and the default is his logon
name and he could change that at app startup. This is only an example
but if i want to continue using the My.Settings class then how would
i dynamically change the default. Again the INI API has a default
that you can dynamically change and all im looking for is a similar
mechanism.

First code that runs goes

If Not My.Settings.Initialized Then
My.Settings.UserName = My.User.Name
' set any other "dynamic defaults" here...
My.Settings.Initialized = True
My.Settings.Save()
End If

After that one time, the settings will behave as usual.

ok i see what you are saying. ill give that a shot. im surprised that MS
didnt add that as a feature. the My.Settings class is very useful on its own
but it still needs some work IMO. Does VS2008 support dynamic defaults?

AGP
Sep 5 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jennie | last post by:
I need to collect dynamic SQL execution times for a production database. However, the totals are not being updated, despite setting the DFT_MON_TIMESTAMP on. The DFT_MON_TIMESTAMP is listed in...
0
by: Kenneth Jonsson | last post by:
I have posted this in microsoft.public.dotnet.framework.aspnet.webservices without any response. My problem is with connections from client computers with a dynamic proxy settings in IE to my...
7
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We...
1
by: Satish.Talyan | last post by:
hi, i want to create a dynamic tree hierarchy in javascript.there are two parts in tree, group & user.when we click on group then users come under that's tree category will be opened.problem is...
5
by: alingsjtu | last post by:
Hello, every body. When execute dynamic generated multiple OPENQUERY statements (which linkes to DB2) in SQLServer, I always got SQL1040N The maximum number of applications is already connected...
2
by: Sin Jeong-hun | last post by:
I've read the "How to: Create Application Settings" article (http:// msdn2.microsoft.com/en-us/library/ms171565.aspx) on the MSDN. It looked fine. But this code is only good when all the settings...
1
by: unsichtbar | last post by:
Sorry, but I'm pretty new to .NET/XML etc... I have the current code which I'm trying to output dynamically so it can be read into a flash file. The only issue is, it doesn't seem to actually do...
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...
3
by: =?Utf-8?B?U3ViYQ==?= | last post by:
I am using a asp page to dynamically create a stylesheet my asp page creates the following css element when i call the asp page my typing the url in the browser. My asp page works...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...

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.