by Angsuman Banerji (23 Submissions)
Category: Registry
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 4th January 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)
To Save a Form's position to the Registry
.ClassKey = HKEY_CURRENT_USER
' You don't need to check if this key already exists
' - the class will create it for you
.SectionKey = "Software\" & App.ExeName & "\" & frmThis.Name
.ValueKey = "Maximized"
.ValueType = REG_DWORD
.Value = (frmThis.WindowState = vbMaximized)
If (frmThis.WindowState <> vbMaximized)
.ValueKey = "Left"
.Value = frmThis.Left
.ValueKey = "Top"
.Value = frmThis.Top
.ValueKey = "Width"
.Value = frmThis.Width
.ValueKey = "Height"
.Value = frmThis.Height
End If
End With