CodeItBetter Programming Another VB Programming Blog

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.

Posted on July 2, 2011
1
2
3
4
5
6
7
8
9
10
11
12
13
'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.
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
Filed under: Registry Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.