Reputation: 20484
I need to add a commandline option to hide mi application if the parameter to hide the form is passed...
It's a Windowsform.
This is what I've tried but the form don't hides:
Private Sub Parse_Arguments()
For I As Integer = 0 To My.Application.CommandLineArgs.Count - 1
If My.Application.CommandLineArgs.Item(I).ToLower = "/s" Then
Me.Visible = False
Me.Hide()
'Me.Visible = True
End If
Next
End Sub
Upvotes: 0
Views: 2773
Reputation: 39142
Set Opacity() to 0 (zero), and FormBorderStyle() to SizableToolWindow:
Private Sub Parse_Arguments()
For I As Integer = 0 To My.Application.CommandLineArgs.Count - 1
If My.Application.CommandLineArgs.Item(I).ToLower = "/s" Then
Me.Opacity = 0 ' completely invisible
Me.FormBorderStyle = FormBorderStyle.SizableToolWindow ' hide from alt-tab
Me.ShowInTaskbar = False
End If
Next
End Sub
Upvotes: 1
Reputation: 1082
Try this technique : it wont hide it, but it will be minimized:
Me.WindowState = FormWindowState.Minimized
if you don't want it showing on the task bar either, you can add this line:
Me.ShowInTaskbar = False
Upvotes: 4