VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Save Form Size, the right way

Elias Barbosa  (9 Submissions)   Registry   Visual Basic 3.0   Beginner   Wed 3rd February 2021

Microsoft provided a pretty lame example of saving the Form Size on Registry. This example is on the MSDN Library.
In 20 minutes I was able to write a few lines of code that will save not only the Form Size but also the WindowState!
The WindowState is a commonly forgotten property that should always be saved. A very surprising example of this mistake can be found on Adobe Illustrator 10! When I Maximize Illustrator's window and, then, close the application, it doesn't memorize the WindowState. When I reopen Illustrator, its window fills the entire screen but it is on Normal WindowState. Because of this, the window is always a little bit off the right position. I always end up maximizing the window. Every single time!!
Don't do the same mistake! Just follow the instructions below and you will be home free! :)
============================================================
Update 05/31/02 - 3:22AM! (My wife hates me!!) :)
============================================================
I heard the crowd and made considerable changes on the code. Now it checks the screen size so, in the rare event that the user reduces the resolution of his monitor, the Form will not end up off screen or too big.
I, also, fixed a little bug on the Form Unload event. (What would you expect from a code that took me only 20 minutes to write!!) :)
============================================================
Update 05/31/02 - 11:16AM! (Now, my boss hates me, too!!) :)
============================================================
I just made a few tweaks on the code. I can't help it. I am a perfectionist! :)
The code will, now, use the name of the Form to create the name of the keys that are going to be created on Registry.

Rate Save Form Size, the right way (12(12 Vote))
Save Form Size, the right way.bas

Save Form Size, the right way Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters