Results 1 to 4 of 4

Thread: Command$ multiple args

  1. #1

    Thread Starter
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901

    Command$ multiple args

    VB Code:
    1. Private Sub Form_Load()
    2.   Dim strComm As String
    3.  
    4.   strComm = Command$
    5.  
    6.   MsgBox strComm
    7. End Sub


    How do I incorporate multiple command parameters.
    I have seen a way to do it with arrays ... but that confused me
    ..Can anyone shed some light?

    Seahag

  2. #2
    Member
    Join Date
    Aug 2000
    Posts
    32
    You could pass in a delimeted string something like
    [arg1][arg2]
    and then just parse it apart by grabing whatever is between the brackets. Use Instr to find the the brackets
    gl
    VB 6, SQL, Java, AutoLISP, Avenue and on a good day AML

  3. #3

    Thread Starter
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    I have found this.. but cant get it to work in the If statements.



    VB Code:
    1. Private Sub Form_Load()
    2. Dim sArgs() As String
    3. Dim i As Integer
    4.  
    5.  
    6. sArgs = Split(Command, ",")
    7. For i = 0 To UBound(sArgs)
    8.     Print sArgs(i)
    9. Next i
    10.  
    11.  
    12.  
    13. If sArgs(0) = "yes" Then
    14. MsgBox "YUp0"
    15. Else
    16. MsgBox "nope"
    17. End If
    18.  
    19. If sArgs(1) = "yes" Then
    20. MsgBox "YUp1"
    21. Else
    22. MsgBox "nope"
    23. End If
    24.  
    25. If sArgs(2) = "yes" Then
    26. MsgBox "YUp2"
    27. Else
    28. MsgBox "nope"
    29. End If
    30.  
    31. End Sub

  4. #4
    Hyperactive Member Jason Badon's Avatar
    Join Date
    Feb 2001
    Location
    Colorado
    Posts
    329
    VB Code:
    1. Private Sub Form_Load()
    2. Dim sArgs() As String
    3. Dim i As Integer
    4.  
    5.  
    6. sArgs = Split(Command, "/")
    7.  
    8.  
    9. If sArgs(1) = "yes " Then
    10.     MsgBox "YUp1"
    11. Else
    12.     MsgBox "nope"
    13. End If
    14.  
    15. If sArgs(2) = "yes " Then
    16.     MsgBox "YUp2"
    17. Else
    18.     MsgBox "nope"
    19. End If
    20.  
    21. If sArgs(3) = "yes" Then
    22.     MsgBox "YUp3"
    23. Else
    24.     MsgBox "nope"
    25. End If
    26.  
    27. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width