I have a windows form app in VB I wanted to condition that if arguments were passed through command line, then form should not show. I am not sure why that the following code is not working Any suggestions will be appreciated Thanks Davey
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim args As String() = Environment.GetCommandLineArgs()
MsgBox(args.count())
If args.Count() > 1 Then
If args(1) = "delete" Then
If args.Count() = 3 Then
deletepage(args(2), args(5))
Close()
End If
ElseIf args(1) = "add" Then
If args.Count() >= 5 Then
addpage(args(2), args(3), args(4), args(5))
Close()
End If
End If
End If
loadnames()
End Sub
The message box is coming up and displaying 5 (5 arguments passed) But then the program totally ignores the if statement, and brings up the form??