Solved

200 extra pts:From 'run' Hello.exe  "My String" passes String in program

Posted on 2004-03-26
5
222 Views
Last Modified: 2010-05-01

200 extra points, I asked it in the wrong topic
http://www.experts-exchange.com/Databases/MS_Access/Q_20932956.html

Is it possible to pass a variable from the command line ('Run' in windows) just by opening it providing a parameter from the command line.

Example:

I have a VB EXE called 'Hello.exe'

using a Short-Cut or user types under 'run'

Hello.exe  "My String"

The program receieves a String to use in code


What data types may you pass.

-JP
0
Comment
Question by:sendtojp
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
pg_india earned 50 total points
ID: 10685325
its not difficult
all you have to do is that ur program should be able to read command line parameters. This is how you can access that

For applications developed with Visual Basic and compiled to an .exe file, Command returns any arguments that appear after the name of the application on the command line. For example:

MyApp cmdlineargs

The function is command.

if you have any questions do ask
pg
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 10685350
You only have to put this in your code:
Text1.Text = Command()

And then start your program like Hello.exe 'My string'
0
 
LVL 1

Author Comment

by:sendtojp
ID: 10685432
Sorry about the two Question Posts.

I will figure out how to handle this

-JP
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 10685446
Just create a new project. Add the following code:
Private Sub Form_Load()
    MsgBox Command()
    end
End Sub

Compile it, make an exe (fe project1.exe)

Then run - cmd:

project1.exe "Hello"
0
 
LVL 1

Author Comment

by:sendtojp
ID: 10685520
Sorry I created a mess, not only did I ask the question under the wrong area, I accidently posted it twice.

I will give  pg_india and Dhaest points on each question  pg_india was first to answer but Dhaest clearified it better.


Only one question remains the data types this supports and can you have multiple variables.

Thank You,

-JP

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

895 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

16 Experts available now in Live!

Get 1:1 Help Now