Some basic questions

Posted on 2006-04-27
Last Modified: 2010-04-23
I want to write a small program to convert some file from one format to antoher. So I have no need for Forms or user interface. But I would like to do this in vb 2005 which I own. Should I be doing something special when creating this so that it does not open any forms, or suchlike? Also how would I get a parameter that would be passed to this program when it is run?
Question by:curious77
    LVL 62

    Accepted Solution

    Hi curious77;

    You can create a console application and place the below code in the Sum Main(). To feed in parameters from the development environment click on the main menu Project -> "ApplicationName" Properties..., last menu pick. Click on the Debug tab. Enter the Command line arguments: in the text box to the right.

            Dim cmdLineParm() As String = Environment.GetCommandLineArgs()

            ' the first element of the array is the path of the executable with file name
            Console.WriteLine("The prgram that started this execution = " & _

            ' If ther are more elements in the array then those are the parameters
            ' on the command line.
            If cmdLineParm.Length > 1 Then
                ' Array's are zero based so we must end 1 less then the length
                For idx As Integer = 1 To cmdLineParm.Length - 1
                    ' Display the parameter on one line in the console window.
                    ' each parameter is separated by a space character.
                    Console.WriteLine("Parameter Numbe " & idx & " = " & _
            End If

            ' This is here so that the console window is not closed after the program
            ' runs. Hit the enter key to end program.

    LVL 3

    Expert Comment

    Your program can have no form if you dont like a form. And it doesnot have to be a console application.
    Just create a module and a sub main, and then do everything there.
    You may use openfiledialog, savefiledialog, or even inputbox to get parameters.
    Hope this helps.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video discusses moving either the default database or any database to a new volume.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now