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
Solved

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

Posted on 2004-03-26
5
229 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MsgBox 2 59
Exit a vb6 apps when a calling it apps closes 15 52
VBA: Select SQL query based on a config Sheet v2 11 49
transition to visual .net from vb6 5 39
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…

839 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