Question : Reading command line arguments in VB.Net

I am trying to read a command line in my program. I want to test it under debug condtions first so I can trap and test.

The code snippet shows the code I am using.

The attached image shows the error message I get. As seems to be typical with MS, it tells me something is wrng but gives me no clue how to correct the issue.

I'd appreciate it if somoen could review the code and also advise how to pass command line arguments when I'm in debug mode.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
Dim cmdArg As String = Environment.CommandLine()
        Dim cmdReturn As String()
        cmdReturn = cmdArg.Split(New [Char]() {"?"c})
         If cmdReturn.Length > 1 Then
            If Trim(cmdReturn(1)) = "/Q" Or Trim(cmdReturn(1)) = "/q" Then
                runSilent = True
            End If
            If Trim(cmdReturn(2)) = "/T" Or Trim(cmdReturn(2)) = "/t" Then
                auditResultsPath = cmdArg.Substring(cmdArg.LastIndexOf("/t") + 3)
            End If
            If runSilent = True Then
                ' Do Audit
                btnAudit.Enabled = False
                Dim addsender As Object
                addsender = btnAudit
                menuAudit_Click(btnAudit, e)

                ' Finished
                Me.Close()

            End If
        End If
Attachments:
 
Error dialog
Error dialog
 

Answer : Reading command line arguments in VB.Net

According to "SDY" here:
http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/ff3cda97-8772-4a62-a54b-e4faf5b8cffa

You simply:

In Project properties -> Security I unchecked the "Enable ClickOnce Security Settings" and then it worked again.

Further down, "SteveC_Sharp" offers this as well:

GOTO the Project security tab and do this
  1. Click 'This is a partial trust application'
  2. Click Advanced Button (toward the bottom)
  3. unClick 'Debug this application with the selected permission set'
  4. Click 'OK'
  5. Click 'This is a full trust application' (this will undo step #1)
Random Solutions  
 
programming4us programming4us