Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing arguments to an application

Posted on 2003-11-30
5
Medium Priority
?
287 Views
Last Modified: 2010-05-01
How can I pass arguments to a VB application (.exe - in main()?)
How do I refer to this arguments in the code?
0
Comment
Question by:SaadDani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 11

Accepted Solution

by:
dbrckovi earned 400 total points
ID: 9848598
In Visual Basic, the command line arguments can be accessed through 'Command' string variable.
So if you wish to access only particular argument then you have to split this string to array of arguments:

Try this:
---------------------------------------
Private Sub Command1_Click()
    Dim args() As String                         'Create an empty array which will be used to store arguments
    Print Command                                'Print the entire line of arguments
    args() = Split(Command, " ")            'Split this line into an array
    For x = 0 To UBound(args)
        Print args(x)                                'Print each argument separately
    Next x
End Sub
---------------------------------------
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9848601
BTW. You have two identical questions open.
0
 

Author Comment

by:SaadDani
ID: 9848640
What type of application it must be and do I have to declare something?
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9848659
If your application is compiled to exe (any kind) then it will work.
You don't have to declare anything.
If you wish to test this during design time, then set the command line arguments under    Project  -  Properties  -  'Make' Tab   in Visual Basic
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9848663
If your application is compiled to exe (any kind) then it will work.
You don't have to declare anything.
If you wish to test this during design time, then set the command line arguments under    Project  -  Properties  -  'Make' Tab   in Visual Basic
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

715 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