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


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
LVL 1
sendtojpAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
pg_indiaConnect With a Mentor Commented:
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
 
DhaestCommented:
You only have to put this in your code:
Text1.Text = Command()

And then start your program like Hello.exe 'My string'
0
 
sendtojpAuthor Commented:
Sorry about the two Question Posts.

I will figure out how to handle this

-JP
0
 
DhaestCommented:
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
 
sendtojpAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.