Click here to Skip to main content
15,885,278 members
Articles / Programming Languages / Visual Basic
Article

VB 6.0 to VB.NET Migration Command Line Arguments Issue

Rate me:
Please Sign up or sign in to vote.
4.83/5 (12 votes)
29 Oct 2006CPOL4 min read 78.8K   16   6
Command line arguments issue when we migrate a VB 6.0 application to VB.NET using the VB.NET upgrade wizard

Introduction

When we migrate a Visual Basic 6.0 application to Visual Basic .NET using Visual Basic .NET upgrade wizard in Visual Studio .NET 2003, we have to take care of certain areas in the migrated application for smoother execution. This article will discuss one of the key areas, called command line arguments, which we need to consider as post-migration changes in the upgraded Visual Basic .NET application.

Visual Basic Command Line Arguments

One of the main features of Visual Basic is the ability to accept command-line parameters when an application is executed. Even with a GUI available to you, there are some cases in which you need to build a VB application that doesn't have a front-end. In these cases, one of the easiest ways to control the function of the application is through command line arguments. Command line arguments are passed into Visual Basic by way of the Command$ variable. This variable is a very long string with all the arguments written exactly as the user entered them. When running an application, you would add them to the shortcut or the Run line.

Visual Basic 6.0 to Visual Basic .NET Migration

Microsoft has provided the Visual Basic .NET upgrade wizard as part of the Visual Studio .NET 2003 IDE. It assists the user with upgrading an existing Visual Basic 6.0 application to a Visual Basic .NET application with minimal effort. The wizard makes all the necessary syntax changes. The Visual Basic 6.0 forms and controls are upgraded into the proper Windows Forms and controls in Visual Basic .NET.

However, there are many features in Visual Basic 6.0 applications that are not upgraded by the wizard. This is primarily due to the very significant differences in the syntax and the architecture between Visual Basic 6.0 and Visual Basic .NET. The upgrade wizard provides a good starting point for the migration because it upgrades the basic features of the Visual Basic 6.0 application. Post-migration changes have to be done in Visual Basic .NET code to make it work in the Microsoft .NET environment, based on the issues identified in the upgrade report.

Command Line Argument Issue

The upgrade wizard will not identify all the issues while upgrading from Visual Basic 6.0 to Visual Basic .NET. One of the key issues is that the upgrade wizard will not identify the command line arguments from the project properties of the existing Visual Basic 6.0 application. If the existing Visual Basic 6.0 application has command line arguments then the upgrade wizard does not take those command line arguments to Visual Basic .NET. We have to copy this command line information manually and put in the Visual Basic .NET debugger. To do this, we have to proceed with the following steps...

Identify the Command Line Argument from the Existing Visual Basic 6.0 Application

  1. Open the Visual Basic 6.0 application's project
  2. Select Properties from the Project menu
  3. Click the Make tab
  4. As shown below, check if there are any arguments in the Command Line Arguments box that the application takes

    VBConfiguration.Jpg
  5. If you have found any arguments listed as similar to the above, then copy these argument values.

Set Command Line Arguments in the Visual Basic .NET Application

Once the upgrade wizard completes the migration from Visual Basic 6.0 to Visual Basic .NET, from the Visual Basic .NET project IDE:

  1. Open the migrated Visual Basic .NET application solution
  2. Select Properties from the Project menu
  3. Click Configuration Properties from the left-hand side pane and click on Debugging
  4. Select Debug from the Configuration dropdown.
  5. As shown below, paste the command line arguments which we have copied in the previous section in the Command Line Arguments box under the Start Options section
VBNETConfiguration.Jpg
  1. Click the Apply button
  2. Now select Release from the Configuration dropdown
  3. Again, paste the command line argument which we have copied in the previous section in the Command Line Arguments box under the Start Options section

Note: Here we are pasting the copied command line arguments for both Debug and Release mode builds.

  1. Click Apply and then click the OK button

Conclusion

Doing these manual changes will help the migration process go smoother and faster. Similarly, the developer has also to take other configuration items which are done in the existing Visual Basic 6.0 application while upgrading to Visual Basic .NET.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questioncommand line parameters Pin
MZektser26-Mar-08 8:29
MZektser26-Mar-08 8:29 
GeneralThe images are not loading! Pin
MojoJosh25-Oct-06 3:38
MojoJosh25-Oct-06 3:38 
GeneralRe: The images are not loading! Pin
gxdata30-Oct-06 21:51
gxdata30-Oct-06 21:51 
GeneralRe: The images are not loading! Pin
MojoJosh31-Oct-06 2:41
MojoJosh31-Oct-06 2:41 
AnswerRe: The images are not loading! Pin
Sadish Kumar.V31-Oct-06 2:46
Sadish Kumar.V31-Oct-06 2:46 
GeneralRe: The images are not loading! Pin
gxdata31-Oct-06 4:00
gxdata31-Oct-06 4:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.