• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

2. Forms > 2.10. Store the Sizes and Locations of Forms

2.10. Store the Sizes and Locations of Forms

Problem

Your application uses a number of forms that you can move around the screen. You’d like to store the last location away somewhere so that the forms will appear in the same location the next time you start the application.

Solution

Some Windows applications are “smart” and can save the locations of their windows when they exit. Your application can do this, too, using the system registry. You can store settings when you close a form and read them back the next time you open it.

Open and run the form frmSavePos in 02-10.MDB. Move it around the screen, and perhaps resize it. When you close the form, code attached to the Close event will save its coordinates in the system registry database. When you reopen the form, if the form can find the saved values in the registry, it will reload the last set of coordinates and will size and position itself accordingly.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint