I was on the forum yesterday asking for help with using command line parameters. As described I am new to vb.net programming, and I am stuck with what is probably a very simply problem.

I am trying to create a vb.net program to which I will be passed parameters from another program. As a test I am doing the very simple following code

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Label1.Text = My.Application.CommandLineArgs(0)

End Sub
When I am running this in debug mode, with a command line parameter passed, the label shows the expected result. However whenever I try and publish the program, and install it, I get an error saying

"Index was out of range. Must be non-negative and less than the size of the collection".

I am thinking this is because I need to run it from the command line, however, i am not even sure how to do this! In the folder where the setup.exe exists there is a windowsApplication1 application manifest, but I cant find the .exe.

Please can anyone help with this??? It has been driving me crazy!

Kindest regards,


When you clicked "Publish Now" under the Publish tab it builds all the files, including one called something like "windowsApplication1.exe.deploy". This is the exe file but VB.NET has added the .deploy to the file name

You can remove the .deploy yourself or get VB.NET to do it for you by:
When in the Publish tab click Options and untick "Use .deploy file extension" then click "Publish Now"

This question has already been answered. Start a new discussion instead.