Visual Basic's SaveSetting and GetSetting methods let you easily save and restore settings in the Registry but that's not the only place you can store settings.
Program settings have the advantage that they are strongly typed and they should also work on even on platforms that do not have a Registry, such as a Unix system using Mono to run a Visual Basic .NET application. (Although I haven't tried this because I don't have Unix installed. If you try it, let me know how it works.)
To make the settings, open the project's Properties pages and select the Settings tab. Create Integer settings named Left, Top, Width, and Height. Give them some reasonable default values to use when the program first starts.
When the program starts, the following code loads the form's settings.
|