WindowState.Minimized vs. Me.Hide

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

Using the below code, If I use Me.WindowState=Minimized the program runs
fine, but you have the taskbar showing the program running.

If I use Me.Hide instead, the program immediately exits.

If UCase(Microsoft.VisualBasic.Command) = "/SILENT" Then
Me.WindowState = FormWindowState.Minimized
silent = True
For i As Integer = 0 To clbPCs.Items.Count - 1
clbPCs.SetItemChecked(i, True)
Next
Button1.PerformClick()
Application.Exit()
End If
 
Terry Olsen said:
Using the below code, If I use Me.WindowState=Minimized the program runs
fine, but you have the taskbar showing the program running.

If I use Me.Hide instead, the program immediately exits.

If UCase(Microsoft.VisualBasic.Command) = "/SILENT" Then
Me.WindowState = FormWindowState.Minimized
silent = True
For i As Integer = 0 To clbPCs.Items.Count - 1
clbPCs.SetItemChecked(i, True)
Next
Button1.PerformClick()
Application.Exit()
End If

You are calling 'Application.Exit', and thus your application exits. In
addition to that, the form is invisible, so 'Button1.PerformClick' won't
raise the button's 'Click' event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top