Solved

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

Posted on 2004-03-26
5
219 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
Comment Utility
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
Comment Utility
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
Comment Utility
Sorry about the two Question Posts.

I will figure out how to handle this

-JP
0
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 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

9 Experts available now in Live!

Get 1:1 Help Now