From: johnb on
Thanks Onur
since my last post I've been reading up on this and concluded that MySetting
was an option. I read up on the methods you've outlined.

Thanks once more
johnb

"Onur Güzel" wrote:

> On May 8, 1:09 pm, johnb <jo...(a)discussions.microsoft.com> wrote:
> > Onur,
> > That works a treat! But how do I persist(save) those new control postions,
> > so that when the app is closed and opened the last positions are maintained.
> >
> > regards
> > johnb
> >
> > "johnb" wrote:
> > > Hi Guys
> > > I'm trying to get started on allowing the user move a button control around
> > > a Form. For example I have say 30 jobs to do. Each button is a job and
> > > clicking on it will reveal that job's details. The user wants not started
> > > jobs on the left of a Form, those in progress in the middle and completed on
> > > the right.
> >
> > > I don't think it's not a drag and drop job. It's more "Move a control at
> > > runtime" by dragging it
> >
> > > TIA
> > > johnb
>
> Hi John,
>
> You have a couple of choices. You can try to use My.Settings by
> defining control's Location property's X and Y coordinates.
>
> http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx
>
> Plus, just save location's X and Y coordinates in a text-based file
> using File.WriteAllText:
>
> http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx
>
> Also, you can find an INI library to group each control's location in
> the same way you're storing locations in human-readable format:
>
> http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mozilla%3Atr%3Aofficial&q=vb.net+ini+library&aq=f&aqi=&aql=&oq=&gs_rfai=
>
> You need to apply the settings in Form_Load and save anytime you want,
> preferably in Form_Close events.
>
> HTH,
>
> Onur Güzel
> .
>
From: johnb on
Hi Onur,
I'm having trouble getting My.Setting to update. I've added a Setting in the
Project Properties Settings and added New name and call it Test, a Type and
set to string with Scope set to user and Value to "TestOnly"

Then on a Form added a button with the click event set it to
My.Settings.Test = "XXXX" and
My.Settings.Save()

I then closed the project; re-opened it and the Test setting was still
"TestOnly" Any ideas where I'm going wrong?

TIA
johnb



"Onur Güzel" wrote:

> On May 8, 1:09 pm, johnb <jo...(a)discussions.microsoft.com> wrote:
> > Onur,
> > That works a treat! But how do I persist(save) those new control postions,
> > so that when the app is closed and opened the last positions are maintained.
> >
> > regards
> > johnb
> >
> > "johnb" wrote:
> > > Hi Guys
> > > I'm trying to get started on allowing the user move a button control around
> > > a Form. For example I have say 30 jobs to do. Each button is a job and
> > > clicking on it will reveal that job's details. The user wants not started
> > > jobs on the left of a Form, those in progress in the middle and completed on
> > > the right.
> >
> > > I don't think it's not a drag and drop job. It's more "Move a control at
> > > runtime" by dragging it
> >
> > > TIA
> > > johnb
>
> Hi John,
>
> You have a couple of choices. You can try to use My.Settings by
> defining control's Location property's X and Y coordinates.
>
> http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx
>
> Plus, just save location's X and Y coordinates in a text-based file
> using File.WriteAllText:
>
> http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx
>
> Also, you can find an INI library to group each control's location in
> the same way you're storing locations in human-readable format:
>
> http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mozilla%3Atr%3Aofficial&q=vb.net+ini+library&aq=f&aqi=&aql=&oq=&gs_rfai=
>
> You need to apply the settings in Form_Load and save anytime you want,
> preferably in Form_Close events.
>
> HTH,
>
> Onur Güzel
> .
>
From: Onur Güzel on
On May 11, 6:53 pm, johnb <jo...(a)discussions.microsoft.com> wrote:
> Hi Onur,
> I'm having trouble getting My.Setting to update. I've added a Setting in the
> Project Properties Settings and added New name and call it Test, a Type and
> set to string with Scope set to user and Value to "TestOnly"
>
> Then on a Form added a button with the click event set it to
> My.Settings.Test = "XXXX" and
> My.Settings.Save()
>
> I then closed the project; re-opened it and the Test setting was still
> "TestOnly" Any ideas where I'm going wrong?
>
> TIA
> johnb
>
> "Onur Güzel" wrote:
> > On May 8, 1:09 pm, johnb <jo...(a)discussions.microsoft.com> wrote:
> > > Onur,
> > > That works a treat! But how do I persist(save) those new control postions,
> > > so that when the app is closed and opened the last positions are maintained.
>
> > > regards
> > > johnb
>
> > > "johnb" wrote:
> > > > Hi Guys
> > > > I'm trying to get started on allowing the user move a button control around
> > > > a Form. For example I have say 30 jobs to do. Each button is a job and
> > > > clicking on it will reveal that job's details. The user wants not started
> > > > jobs on the left of a Form, those in progress in the middle and completed on
> > > > the right.
>
> > > > I don't think it's not a drag and drop job. It's more "Move a control at
> > > > runtime" by dragging it
>
> > > > TIA
> > > > johnb
>
> > Hi John,
>
> > You have a couple of choices. You can try to use My.Settings by
> > defining control's Location property's X and Y coordinates.
>
> >http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx
>
> > Plus, just save location's X and Y coordinates in a text-based file
> > using File.WriteAllText:
>
> >http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx
>
> > Also, you can find an INI library to group each control's location in
> > the same way you're storing locations in human-readable format:
>
> >http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mo...
>
> > You need to apply the settings in Form_Load and save anytime you want,
> > preferably in Form_Close events.
>
> > HTH,
>
> > Onur Güzel
> > .

Hi,

Couldn't reproduce it. Are you trying to get settings in Form_Load?
After assigning a new value and after you save, it should run with the
last value you've set. You can easily get the assigned string value
just by calling "My.Settings.Test".

Onur Güzel
From: johnb on
Onur,
The code is in the Form_Closing event. You've got it to work so I'm going
wrong somewhere but where?? I shall leave it for an hour or 2 and have
another go

I'm after the Location property settings of a control so what should be in
the Type cell in Settings, I selected System.Drawing.Point (and used others
including String)with scope set to user without any success. I've used both
VB.net 05 and 08.

regards
johnb


"Onur Güzel" wrote:

> On May 11, 6:53 pm, johnb <jo...(a)discussions.microsoft.com> wrote:
> > Hi Onur,
> > I'm having trouble getting My.Setting to update. I've added a Setting in the
> > Project Properties Settings and added New name and call it Test, a Type and
> > set to string with Scope set to user and Value to "TestOnly"
> >
> > Then on a Form added a button with the click event set it to
> > My.Settings.Test = "XXXX" and
> > My.Settings.Save()
> >
> > I then closed the project; re-opened it and the Test setting was still
> > "TestOnly" Any ideas where I'm going wrong?
> >
> > TIA
> > johnb
> >
> > "Onur Güzel" wrote:
> > > On May 8, 1:09 pm, johnb <jo...(a)discussions.microsoft.com> wrote:
> > > > Onur,
> > > > That works a treat! But how do I persist(save) those new control postions,
> > > > so that when the app is closed and opened the last positions are maintained.
> >
> > > > regards
> > > > johnb
> >
> > > > "johnb" wrote:
> > > > > Hi Guys
> > > > > I'm trying to get started on allowing the user move a button control around
> > > > > a Form. For example I have say 30 jobs to do. Each button is a job and
> > > > > clicking on it will reveal that job's details. The user wants not started
> > > > > jobs on the left of a Form, those in progress in the middle and completed on
> > > > > the right.
> >
> > > > > I don't think it's not a drag and drop job. It's more "Move a control at
> > > > > runtime" by dragging it
> >
> > > > > TIA
> > > > > johnb
> >
> > > Hi John,
> >
> > > You have a couple of choices. You can try to use My.Settings by
> > > defining control's Location property's X and Y coordinates.
> >
> > >http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx
> >
> > > Plus, just save location's X and Y coordinates in a text-based file
> > > using File.WriteAllText:
> >
> > >http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx
> >
> > > Also, you can find an INI library to group each control's location in
> > > the same way you're storing locations in human-readable format:
> >
> > >http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mo...
> >
> > > You need to apply the settings in Form_Load and save anytime you want,
> > > preferably in Form_Close events.
> >
> > > HTH,
> >
> > > Onur Güzel
> > > .
>
> Hi,
>
> Couldn't reproduce it. Are you trying to get settings in Form_Load?
> After assigning a new value and after you save, it should run with the
> last value you've set. You can easily get the assigned string value
> just by calling "My.Settings.Test".
>
> Onur Güzel
> .
>
From: Onur Güzel on
On May 12, 11:01 am, johnb <jo...(a)discussions.microsoft.com> wrote:
> Onur,
>  The code is in the Form_Closing event. You've got it to work so I'm going
> wrong somewhere but where?? I shall leave it for an hour or 2 and have
> another go
>
> I'm after the Location property settings of a control so what should be in
> the Type cell in Settings, I selected System.Drawing.Point (and used others
> including String)with scope set to user without any success. I've used both
> VB.net 05 and 08.
>
> regards
> johnb
>
>
>
> "Onur Güzel" wrote:
> > On May 11, 6:53 pm, johnb <jo...(a)discussions.microsoft.com> wrote:
> > > Hi Onur,
> > > I'm having trouble getting My.Setting to update. I've added a Setting in the
> > > Project Properties Settings and added New name and call it Test, a Type and
> > > set to string with Scope set to user and Value to "TestOnly"
>
> > > Then on a Form added a button with the click event set it to
> > > My.Settings.Test = "XXXX" and
> > > My.Settings.Save()
>
> > > I then closed the project; re-opened it and the Test setting was still
> > > "TestOnly" Any ideas where I'm going wrong?
>
> > > TIA
> > > johnb
>
> > > "Onur Güzel" wrote:
> > > > On May 8, 1:09 pm, johnb <jo...(a)discussions.microsoft.com> wrote:
> > > > > Onur,
> > > > > That works a treat! But how do I persist(save) those new control postions,
> > > > > so that when the app is closed and opened the last positions are maintained.
>
> > > > > regards
> > > > > johnb
>
> > > > > "johnb" wrote:
> > > > > > Hi Guys
> > > > > > I'm trying to get started on allowing the user move a button control around
> > > > > > a Form. For example I have say 30 jobs to do. Each button is a job and
> > > > > > clicking on it will reveal that job's details. The user wants not started
> > > > > > jobs on the left of a Form, those in progress in the middle and completed on
> > > > > > the right.
>
> > > > > > I don't think it's not a drag and drop job. It's more "Move a control at
> > > > > > runtime" by dragging it
>
> > > > > > TIA
> > > > > > johnb
>
> > > > Hi John,
>
> > > > You have a couple of choices. You can try to use My.Settings by
> > > > defining control's Location property's X and Y coordinates.
>
> > > >http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx
>
> > > > Plus, just save location's X and Y coordinates in a text-based file
> > > > using File.WriteAllText:
>
> > > >http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx
>
> > > > Also, you can find an INI library to group each control's location in
> > > > the same way you're storing locations in human-readable format:
>
> > > >http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mo...
>
> > > > You need to apply the settings in Form_Load and save anytime you want,
> > > > preferably in Form_Close events.
>
> > > > HTH,
>
> > > > Onur Güzel
> > > > .
>
> > Hi,
>
> > Couldn't reproduce it. Are you trying to get settings in Form_Load?
> > After assigning a new value and after you save, it should run with the
> > last value you've set. You can easily get the assigned string value
> > just by calling "My.Settings.Test".
>
> > Onur Güzel
> > .- Hide quoted text -
>
> - Show quoted text -

Ok, here is my full shot for saving location of controls and re-
gaining the location on form_load as follows:

Imagine you're dealing with a button and want to remember its last
position, first off, on project settings page->settings tab, enter
"Button1_X" and "Button1_Y" on "Name" column, set the both's type to
"Integer", leave "Scope" as "User" and "Value" field(s) blank.

Add the following code to your application:

'-----------------------------------------
Private Sub Form1_FormClosing _
(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.FormClosingEventArgs) _
Handles MyBase.FormClosing

With My.Settings
' Assign values of current location's
' just before closing the form
..Button1_X = Button1.Location.X
..Button1_Y = Button1.Location.Y

' Save settings, so they'll
'be rememnbered on next launch
My.Settings.Save()
End With

End Sub

Private Sub Form1_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load

With My.Settings
' Apply saved location settings
' by creating a new instance of Point
Button1.Location = New Point(.Button1_X, .Button1_Y)
End With


End Sub
'-----------------------------------------


Hope this gives some idea,

Onur Güzel