Results 1 to 4 of 4

Thread: Form Restore

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 1999
    Location
    London, UK
    Posts
    58

    Post

    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: [email protected] *
    * *
    * * * * * * * * * * * * * * * * * * * * * *

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    You can create a variable that would hold the state of the window and then resize to that last state.

    Code:
    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
    [email protected]
    [email protected]
    ICQ#: 51055819


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

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Post

    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
    [email protected]
    [email protected]
    www.YellowBlazer.com



  4. #4

    Thread Starter
    Member
    Join Date
    Jan 1999
    Location
    London, UK
    Posts
    58

    Post

    Oh how easy!

    Thanks folks.

    AndyC



    ------------------
    * * * * * * * * * * * * * * * * * * * * * *
    * *
    * AndyC *
    * London *
    * email: [email protected] *
    * *
    * * * * * * * * * * * * * * * * * * * * * *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width