Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Some basic questions

Posted on 2006-04-27
2
Medium Priority
?
177 Views
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?
0
Comment
Question by:curious77
2 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 600 total points
ID: 16557924
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 = " & _
            cmdLineParm(0))

        ' 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 & " = " & _
                    cmdLineParm(idx))
            Next
        End If

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


Fernando
0
 
LVL 3

Expert Comment

by:snow_moon
ID: 16557948
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.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

564 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