Solved

Reading parameters

Posted on 1998-07-01
1
122 Views
Last Modified: 2010-05-03
I'm currently writing a little utility program. This program is launched with 3 parameters. I need to get the values of these parameters into my program. How do I do this?

The parameters are folders so there will be spaces in the params. They are seperated by a comma (,).

Thanks for your help
Teddy
0
Comment
Question by:tflarsen
[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
1 Comment
 
LVL 2

Accepted Solution

by:
swilt earned 100 total points
ID: 1464663
Set up test data using
   Project
   Project Properties
   Make
   Command Line Arguments


Option Explicit

Private Sub Form_Load()
    Dim i As Integer
    Dim sCmd As String
    Dim sParams(2) As String
   
    sCmd = Command$
    sParams(0) = sChopStr(sCmd)
    sParams(1) = sChopStr(sCmd)
    sParams(2) = sChopStr(sCmd)
   
    For i = 0 To 2
        MsgBox "Param " & i & " " & sParams(i)
    Next i
End Sub

Private Function sChopStr(sInp As String) As String
    Dim p As Integer
    Dim sRet As String
   
    sInp = Trim$(sInp)
    p = InStr(sInp, ",")
    If p > 0 Then
        sRet = Left$(sInp, p - 1)
        sInp = Mid$(sInp, p + 1)
    Else
        sRet = sInp
        sInp = ""
    End If
    sChopStr = sRet
End Function

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

737 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