Remember Window Position - Tutorial

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
3 posts Page 1 of 1
Contributors
User avatar
Skillful
Skillful Coders
Skillful Coders
Posts: 969
Joined: Tue Nov 16, 2010 10:07 am

Hello guys.
Here I present my new tutorial.
This tutorial will teach you how to remember your application window's once it has been moved from its original position.
Ok so lets start -

1. Open VB.NET and create a new Windows Forms Application.

2. Once the project is created, on the menu strip on the top, click on Project--->WindowsFormsApplication1 Properties

3. Once you click there, go on the Settings tab.

4. Create a new setting with the following properties -
Name - Position
Type - System.Drawing.Point
Scope - User

5. Then go to Form1 and the in the properties expand the ApplicationSettings and set the location property to Position.

6. Debug the project, move the form anywhere on the screen and then exit the app.

7. Debug the project again. Your application will load in the position from where you exit it last time.

Hope you liked my tutorial. :)

Regards, cooll;
CoderBoy1201
Instead of LOL use this -
LSIBMHBIWFETALOL

Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Maybe add some images this is kindof confusing :?
Top-notch casual Dating
User avatar
shekoasinger
New Member
New Member
Posts: 23
Joined: Sat Dec 04, 2010 9:40 pm

What he said is kind of really advanced, havent tried it myself but seems good. The normal way of using the setting is:

Create a form .Load event:
Code: Select all
Me.Location = My.Settings.Location
And on the form .Closing event:
Code: Select all
My.Settings.Location = Me.Location
My.Settings.Save()
3 posts Page 1 of 1
Return to “Tutorials”