Solved

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

Posted on 2004-03-26
5
234 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
[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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

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