Is anyone able to make My.Settings work? I can't!

J

Just_a_fan

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)
My.Settings.Brkr2 = BreakerAmps(2)
My.Settings.Brkr3 = BreakerAmps(3)
My.Settings.Brkr4 = BreakerAmps(4)
My.Settings.Brkr5 = BreakerAmps(5)


then I do a: My.Settings.Save

after all of the My.Settings commands and exit the program.


On the way in next time, I do:

BreakerAmps(1) = CInt(My.Settings.Brkr1)
BreakerAmps(2) = CInt(My.Settings.Brkr2)
BreakerAmps(3) = CInt(My.Settings.Brkr3)
BreakerAmps(4) = CInt(My.Settings.Brkr4)
BreakerAmps(5) = CInt(My.Settings.Brkr5)

and when I get to my settings screen, they are back to the default that
was entered when I set up the settings entries by hand.

I tried doing a My.Settings.Reload during the invocation just in case
but it made no different.

Ideas?

Where can I see the "persistent" values so help find the problem area.

My MSDN help is still broken via the VS help system. Says it is down
(does not seem to be) or my User/PW is broken (but does not let me
reenter it) so getting help got just that much harder and it was already
hard enough!

Mike Morrow
MMSA00E62537
 
C

Cor Ligthert[MVP]

Mike,

In this millenium there is more than Atari programming. The mySettings are
based on all kind of data in the computer.

By instance the XML config file. It is not just simple a piece of memory
that you withouth having allocated can use.

Cor
 
J

Just_a_fan

I found out what is happening.

When you copy code around to clean things up a little bit and get stuff
that is similar, together, (refactoring, sorta) VB loses the Handles
clauses. They simply vanish. It has happened several times to me and
this time, it happened on the form close and it was not running to save
the values. I put it back in and now the routine runs and I save the
data.

Don't say I forgot to copy it. I copied the Sub command and the code
and the Handles is right inline with it. I could not miss copying it
when I move a whole routine but at the destination, the Handles is
missing and I missed noticing that it had gone away.

Settings is not "working" since the routine to drive it is back.

I hope someone fixes that little problem soon.

Mike
 
C

Cor Ligthert[MVP]

Mike,

That is no problem, the problem is that you are meshing up with the code.

You can cut it and set it on another place, but how would be known which of
the exact equal event methode should be taken as you copy it. Be happy that
it is not deleted from the original one too.

However, I am curious how you think that you can refactor code as you don't
even know the basics?

Cor
 
S

ShaneO

I found out what is happening.

I hope someone fixes that little problem soon.

Mike
I've posted the following code at earlier times, and I'll list it again,
it will fix your problem -

1. Create a new setting, such as "SettingsValid" and set its default
value to False. (This is important!)

2. Place the following code at the beginning of your Form_Load event -

If Not My.Settings.SettingsValid Then
My.Settings.Upgrade()
My.Settings.SettingsValid = True
My.Settings.Save()
End If


Hope this helps.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
 
H

Herfried K. Wagner [MVP]

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)
My.Settings.Brkr2 = BreakerAmps(2)
My.Settings.Brkr3 = BreakerAmps(3)
My.Settings.Brkr4 = BreakerAmps(4)
My.Settings.Brkr5 = BreakerAmps(5)


then I do a: My.Settings.Save

after all of the My.Settings commands and exit the program.


On the way in next time, I do:

BreakerAmps(1) = CInt(My.Settings.Brkr1)
BreakerAmps(2) = CInt(My.Settings.Brkr2)
BreakerAmps(3) = CInt(My.Settings.Brkr3)
BreakerAmps(4) = CInt(My.Settings.Brkr4)
BreakerAmps(5) = CInt(My.Settings.Brkr5)

and when I get to my settings screen, they are back to the default that
was entered when I set up the settings entries by hand.

Make sure the settings are /user/ settings and not /application/ settings.
Only user settings can be saved.
 
S

SurturZ

Cor Ligthert said:
However, I am curious how you think that you can refactor code as you don't
even know the basics?

Cor

What a rude and unhelpful reply!
 
P

Price Brattin

To: David Streeter,

What is wrong with the reply? It makes perfect sense to me. That reply answered my question.



surtur wrote:

Re: Re: Is anyone able to make My.Settings work? I can't!
30-Jun-08

:

What a rude and unhelpful reply!

--
David Streeter
Synchrotech Software
Sydney Australia

Previous Posts In This Thread:

Is anyone able to make My.Settings work? I can't!
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)
My.Settings.Brkr2 = BreakerAmps(2)
My.Settings.Brkr3 = BreakerAmps(3)
My.Settings.Brkr4 = BreakerAmps(4)
My.Settings.Brkr5 = BreakerAmps(5)


then I do a: My.Settings.Save

after all of the My.Settings commands and exit the program.


On the way in next time, I do:

BreakerAmps(1) = CInt(My.Settings.Brkr1)
BreakerAmps(2) = CInt(My.Settings.Brkr2)
BreakerAmps(3) = CInt(My.Settings.Brkr3)
BreakerAmps(4) = CInt(My.Settings.Brkr4)
BreakerAmps(5) = CInt(My.Settings.Brkr5)

and when I get to my settings screen, they are back to the default that
was entered when I set up the settings entries by hand.

I tried doing a My.Settings.Reload during the invocation just in case
but it made no different.

Ideas?

Where can I see the "persistent" values so help find the problem area.

My MSDN help is still broken via the VS help system. Says it is down
(does not seem to be) or my User/PW is broken (but does not let me
reenter it) so getting help got just that much harder and it was already
hard enough!

Mike Morrow
MMSA00E62537

Mike,In this millenium there is more than Atari programming.
Mike,

In this millenium there is more than Atari programming. The mySettings are
based on all kind of data in the computer.

By instance the XML config file. It is not just simple a piece of memory
that you withouth having allocated can use.

Cor

<[email protected]> schreef in bericht

I found out what is happening.
I found out what is happening.

When you copy code around to clean things up a little bit and get stuff
that is similar, together, (refactoring, sorta) VB loses the Handles
clauses. They simply vanish. It has happened several times to me and
this time, it happened on the form close and it was not running to save
the values. I put it back in and now the routine runs and I save the
data.

Don't say I forgot to copy it. I copied the Sub command and the code
and the Handles is right inline with it. I could not miss copying it
when I move a whole routine but at the destination, the Handles is
missing and I missed noticing that it had gone away.

Settings is not "working" since the routine to drive it is back.

I hope someone fixes that little problem soon.

Mike

On Mon, 30 Jun 2008 05:31:28 +0200, in
microsoft.public.dotnet.languages.vb "Cor Ligthert[MVP]"

Mike,That is no problem, the problem is that you are meshing up with the code.
Mike,

That is no problem, the problem is that you are meshing up with the code.

You can cut it and set it on another place, but how would be known which of
the exact equal event methode should be taken as you copy it. Be happy that
it is not deleted from the original one too.

However, I am curious how you think that you can refactor code as you don't
even know the basics?

Cor



<[email protected]> schreef in bericht

Re: Is anyone able to make My.Settings work? I can't!
(e-mail address removed) wrote:
I've posted the following code at earlier times, and I'll list it again,
it will fix your problem -

1. Create a new setting, such as "SettingsValid" and set its default
value to False. (This is important!)

2. Place the following code at the beginning of your Form_Load event -

If Not My.Settings.SettingsValid Then
My.Settings.Upgrade()
My.Settings.SettingsValid = True
My.Settings.Save()
End If


Hope this helps.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.

Re: Is anyone able to make My.Settings work? I can't!

Make sure the settings are /user/ settings and not /application/ settings.
Only user settings can be saved.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Re: Re: Is anyone able to make My.Settings work? I can't!
:

What a rude and unhelpful reply!

--
David Streeter
Synchrotech Software
Sydney Australia

Did you understand it?Cor
Did you understand it?


Cor


Submitted via EggHeadCafe - Software Developer Portal of Choice
Sum of Numbers Captcha: Keeping it Simple
http://www.eggheadcafe.com/tutorial...83-8eb1c526ca7f/sum-of-numbers-captcha-k.aspx
 
P

Price Brattin

To David Streeter,
What is wrong with the reply? It makes perfect sense to me. That reply answered my question.



surtur wrote:

Re: Re: Is anyone able to make My.Settings work? I can't!
30-Jun-08


What a rude and unhelpful reply

-
David Streete
Synchrotech Softwar
Sydney Australia

Previous Posts In This Thread:

Is anyone able to make My.Settings work? I can't!
I save some data to an array in my program. I can reopen the settin
screen and see that the data is, in fact, in the array

I then do a lot of these

My.Settings.Brkr1 = BreakerAmps(1
My.Settings.Brkr2 = BreakerAmps(2
My.Settings.Brkr3 = BreakerAmps(3
My.Settings.Brkr4 = BreakerAmps(4
My.Settings.Brkr5 = BreakerAmps(5

then I do a: My.Settings.Save

after all of the My.Settings commands and exit the program

On the way in next time, I do:

BreakerAmps(1) = CInt(My.Settings.Brkr1
BreakerAmps(2) = CInt(My.Settings.Brkr2
BreakerAmps(3) = CInt(My.Settings.Brkr3
BreakerAmps(4) = CInt(My.Settings.Brkr4
BreakerAmps(5) = CInt(My.Settings.Brkr5

and when I get to my settings screen, they are back to the default tha
was entered when I set up the settings entries by hand

I tried doing a My.Settings.Reload during the invocation just in cas
but it made no different

Ideas

Where can I see the "persistent" values so help find the problem area

My MSDN help is still broken via the VS help system. Says it is dow
(does not seem to be) or my User/PW is broken (but does not let m
reenter it) so getting help got just that much harder and it was alread
hard enough

Mike Morro
MMSA00E62537

Mike,In this millenium there is more than Atari programming.
Mike

In this millenium there is more than Atari programming. The mySettings are
based on all kind of data in the computer

By instance the XML config file. It is not just simple a piece of memory
that you withouth having allocated can use

Co

<[email protected]> schreef in bericht

I found out what is happening.
I found out what is happening.

When you copy code around to clean things up a little bit and get stuf
that is similar, together, (refactoring, sorta) VB loses the Handle
clauses. They simply vanish. It has happened several times to me an
this time, it happened on the form close and it was not running to sav
the values. I put it back in and now the routine runs and I save th
data

Don't say I forgot to copy it. I copied the Sub command and the cod
and the Handles is right inline with it. I could not miss copying i
when I move a whole routine but at the destination, the Handles i
missing and I missed noticing that it had gone away

Settings is not "working" since the routine to drive it is back

I hope someone fixes that little problem soon

Mik

On Mon, 30 Jun 2008 05:31:28 +0200, i
microsoft.public.dotnet.languages.vb "Cor Ligthert[MVP]

Mike,That is no problem, the problem is that you are meshing up with the code.
Mike

That is no problem, the problem is that you are meshing up with the code

You can cut it and set it on another place, but how would be known which of
the exact equal event methode should be taken as you copy it. Be happy that
it is not deleted from the original one too

However, I am curious how you think that you can refactor code as you don't
even know the basics

Co


<[email protected]> schreef in bericht

Re: Is anyone able to make My.Settings work? I can't!
(e-mail address removed) wrote
I've posted the following code at earlier times, and I'll list it again,
it will fix your problem

1. Create a new setting, such as "SettingsValid" and set its default
value to False. (This is important!)

2. Place the following code at the beginning of your Form_Load event -

If Not My.Settings.SettingsValid Then
My.Settings.Upgrade()
My.Settings.SettingsValid = True
My.Settings.Save()
End If


Hope this helps.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.

Re: Is anyone able to make My.Settings work? I can't!

Make sure the settings are /user/ settings and not /application/ settings.
Only user settings can be saved.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Re: Re: Is anyone able to make My.Settings work? I can't!
:

What a rude and unhelpful reply!

--
David Streeter
Synchrotech Software
Sydney Australia

Did you understand it?Cor
Did you understand it?


Cor

Is anyone able to make My.Settings work? I can't!
To: David Streeter,

What is wrong with the reply? It makes perfect sense to me. That reply answered my question.


Submitted via EggHeadCafe - Software Developer Portal of Choice
XML Data Compression / Decompression Over the Wire
http://www.eggheadcafe.com/tutorial...f1-cad42eba100b/xml-data-compression--de.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top