Solved

How to pass parameters to VB exe program ?

Posted on 1998-07-17
3
317 Views
Last Modified: 2010-05-03
I need to pass some parameters into a VB program, so that
the program can display them in a form.
For example : The VB program name is <Try.exe>.

So when a user type <Try.exe "apple" "orange"> then enter
to execute the program the two parameter will be taken in
by the program and display on one of the form Label together.
0
Comment
Question by:KimSeng
[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
3 Comments
 
LVL 18

Accepted Solution

by:
deighton earned 100 total points
ID: 1466062
Use command$ in your program - you don't need quotes around your string

e.g. in your program

    Label1.Caption = Left(Command$, InStr(Command$, " ") - 1)

    Label2.Caption = Right(Command$, Len(Command$) - InStr(Command$, " "))

This chops up the string

to call the exe use

Myprog.exe apple orange

0
 
LVL 18

Expert Comment

by:deighton
ID: 1466063
NB I forgot youd given the program a name, so your users will type

Try.exe apple orange

You could still use quotes as delimeters, but you'd have to write code to strip the relevant text from command$
0
 

Author Comment

by:KimSeng
ID: 1466064
I am a Singaporean who would like to make friends with you.
The answer you give me is excellent, they work very well.

You can e-mail me at this address : kim_seng@yahoo.com  

Thank you !
0

Featured Post

Technology Partners: 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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

623 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