PDA

Click to See Complete Forum and Search --> : Form Restore


Andy Collyer
Nov 18th, 1999, 07:52 PM
Hi again,

How do I *restore* my form to it's original state? After the user has minimized it, I want to be able to programatically restore it to what it was before it was minimized.

The closest I've got is "WindowState = vbNormal" but if the form was maximized before it was minimized, this doesn't actually re-maximize it.

I'm sure this is easy enough - any clues anyone?

Thanks for your help,

AndyC



------------------
* * * * * * * * * * * * * * * * * * * * * *
* *
* AndyC *
* London *
* email: andy.collyer@bigfoot.com *
* *
* * * * * * * * * * * * * * * * * * * * * *

Serge
Nov 18th, 1999, 08:01 PM
You can create a variable that would hold the state of the window and then resize to that last state.


Private m_lngState As Long

Private Sub Form_Resize()
If Not Me.WindowState = vbMinimized Then
m_lngState = Me.WindowState
End If
End Sub




Then whenever you want to restore that form you would put:

Form1.WindowState = m_lngState

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)


[This message has been edited by Serge (edited 11-19-1999).]

Joacim Andersson
Nov 18th, 1999, 08:05 PM
Sure! Declare a module level variable and set it's value in the Form_Resize event:

Private iOldWindowState As Integer

Private Sub Form_Resize()
If Me.WindowState <> vbMinimized Then
iOldWindowState = Me.WindowState
End If
End Sub

Now when you want to restore the window just set the Form's WindowState property to iOldWindowState

Good luck!

------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)

Andy Collyer
Nov 18th, 1999, 08:28 PM
Oh how easy!

Thanks folks.

AndyC



------------------
* * * * * * * * * * * * * * * * * * * * * *
* *
* AndyC *
* London *
* email: andy.collyer@bigfoot.com *
* *
* * * * * * * * * * * * * * * * * * * * * *