Problems Showing Main Form after Hide

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jp2group

    Problems Showing Main Form after Hide

    I have a Main Form that hides in the Task Bar Tray as an Icon until
    one of the Tray Icon's Menu Items is selected. (think of your
    antivirus program running there)

    The program starts up fine and shows the main form fine, but once I
    tell it to hide, it does not want to show back up later.

    What could my problem be?

    Here is my code:

    Public Sub ShowMe(ByVal val As Boolean)
    TopMost = False
    If (val = True) Then
    WindowState = FormWindowState .Normal
    Show()
    ShowInTaskbar = True
    TopMost = True
    ElseIf (val = False) Then
    WindowState = FormWindowState .Minimized
    Hide()
    ShowInTaskbar = False
    End If
    Refresh()
    Application.DoE vents()
    End Sub
  • Lloyd Sheen

    #2
    Re: Problems Showing Main Form after Hide


    "jp2group" <tjpool@gmail.c omwrote in message
    news:c7b8df31-3c55-4ed7-aa42-9f042ce05470@m3 g2000hsc.google groups.com...
    >I have a Main Form that hides in the Task Bar Tray as an Icon until
    one of the Tray Icon's Menu Items is selected. (think of your
    antivirus program running there)
    >
    The program starts up fine and shows the main form fine, but once I
    tell it to hide, it does not want to show back up later.
    >
    What could my problem be?
    >
    Here is my code:
    >
    Public Sub ShowMe(ByVal val As Boolean)
    TopMost = False
    If (val = True) Then
    WindowState = FormWindowState .Normal
    Show()
    ShowInTaskbar = True
    TopMost = True
    ElseIf (val = False) Then
    WindowState = FormWindowState .Minimized
    Hide()
    ShowInTaskbar = False
    End If
    Refresh()
    Application.DoE vents()
    End Sub

    This is code I use

    Private Sub NotifyIcon1_Dou bleClick(ByVal sender As Object, ByVal e As
    System.EventArg s) Handles NotifyIcon1.Dou bleClick
    If Me.WindowState = FormWindowState .Minimized Then
    Me.WindowState = FormWindowState .Maximized
    Me.NotifyIcon1. Visible = False
    End If
    Me.Show()
    Me.Activate()
    End Sub

    Hope this helps
    LS

    Comment

    • Just_a_fan@home.net

      #3
      Re: Re: Problems Showing Main Form after Hide

      In case your form is not intended to be maximized, which is somewhat
      rare, in my experience:

      Private Sub NotifyIcon_Doub leClick(ByVal sender As Object, ByVal e As
      System.EventArg s) Handles NotifyIcon.Doub leClick
      Me.Show()
      Application.DoE vents()
      Me.WindowState = FormWindowState .Normal
      Me.Focus()
      End Sub

      Using the code, below, maximizes the form. Changing "maximize" to
      "normal" also has a problem of leaving the form a small, unusable thing
      down in the corner.

      The DoEvents, above, is probably redundant.

      Mike


      On Sat, 19 Apr 2008 10:57:21 -0400, in
      microsoft.publi c.dotnet.langua ges.vb "Lloyd Sheen" <a@b.cwrote:
      >
      >"jp2group" <tjpool@gmail.c omwrote in message
      >news:c7b8df3 1-3c55-4ed7-aa42-9f042ce05470@m3 g2000hsc.google groups.com...
      >>I have a Main Form that hides in the Task Bar Tray as an Icon until
      >one of the Tray Icon's Menu Items is selected. (think of your
      >antivirus program running there)
      >>
      >The program starts up fine and shows the main form fine, but once I
      >tell it to hide, it does not want to show back up later.
      >>
      >What could my problem be?
      >>
      >Here is my code:
      >>
      > Public Sub ShowMe(ByVal val As Boolean)
      > TopMost = False
      > If (val = True) Then
      > WindowState = FormWindowState .Normal
      > Show()
      > ShowInTaskbar = True
      > TopMost = True
      > ElseIf (val = False) Then
      > WindowState = FormWindowState .Minimized
      > Hide()
      > ShowInTaskbar = False
      > End If
      > Refresh()
      > Application.DoE vents()
      > End Sub
      >
      >
      >This is code I use
      >
      Private Sub NotifyIcon1_Dou bleClick(ByVal sender As Object, ByVal e As
      >System.EventAr gs) Handles NotifyIcon1.Dou bleClick
      If Me.WindowState = FormWindowState .Minimized Then
      Me.WindowState = FormWindowState .Maximized
      Me.NotifyIcon1. Visible = False
      End If
      Me.Show()
      Me.Activate()
      End Sub
      >
      >Hope this helps
      >LS

      Comment

      Working...