How to Restore application from minimized state


Author
Message
Tim Dol
Tim Dol
Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
If I launch an exe from my menu system and minimizes it, how can I restore the application or bring focus back to the application if they happen to click on the menu option again?
Reply
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Well, since you are using n MDI form you can cycle through all of the instantiated forms through the forms collection:

Public Function RestoreForm(ByVal FormType As System.Type) As Boolean
Dim loForm As System.Windows.Forms.Form
Dim llReturn As Boolean = False

For Each loForm In MyMDI.MdiChildren
   If loForm.GetType() Is FormType
      llReturn = True
     
      If loForm.WindowState = FormWindowState.Minimized Then
         loForm.WindowState = FormWindowState.Normal
      End If
   End If   
Next

Return llReturn
End Function

You would call it like this:

If Not RestoreForm(GetType(MyForm)) Then
    '-- Launch your form
End If

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search