Home > How-To Library > Registry
How to retrieve the size of a form from the registry so that the form size persists each time the application is loaded Uses GetSetting registry function.
**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * **************************************************************** Private Sub Form_Load() Dim MyHeight As Integer, MyWidth As Integer MyHeight = GetSetting("TestRegistrySettings", "Startup", "Height", CStr(Screen.Height / 2)) MyWidth = GetSetting("TestRegistrySettings", "Startup", "Width", CStr(Screen.Width / 2)) Me.Height = MyHeight Me.Width = MyWidth End Sub Private Sub Form_Unload(Cancel As Integer) SaveSettings "TestRegistrySettings", "Startup", "Height", CStr(Me.Height) SaveSettings "TestRegistrySettings", "Startup", "Width", CStr(Me.Width) End Sub
If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.