I want to write an application which is working with the values parsed by another application through the command prompt. How do you do that in VB? Working with VB6
Ah yes multiple commands
My favorite.
I use a Pipe to separate them. but they appear to the program as one long string
Say you pass Invoice Number and Date and Amount
Public Function GetCommands(info)
'33455|02/12/01|45.67 Also for testing this I passed a parameter in info
Dim Mystuff As String
Dim FirstPipe, SecondPipe As Integer
‘ Dim PassedInvoice, PasedAmount, PassedDate As String
Mystuff = Command
'Mystuff = info
FirstPipe = InStr(1, Mystuff, "|"
SecondPipe = InStr(FirstPipe + 1, Mystuff, "|"
‘ you can make these Global variables
PassedInvoice = Left(Mystuff, FirstPipe - 1)
PassedDate = Mid(Mystuff, FirstPipe + 1, SecondPipe - FirstPipe - 1)
PasedAmount = Right(Mystuff, Len(Mystuff) - SecondPipe)
There is also a Split() function that breaks a string into pieces at the delimiter of your choosing. The pieces are returned in a variant array of strings--very convenient! Rick Sprague
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.