Link to home
Start Free TrialLog in
Avatar of GlobaLevel
GlobaLevelFlag for United States of America

asked on

vb.net read results from a command line and paste int an array

I have a process that runs by vb.net through the dos command line..and each time it goes through the loop it needs to print an array.. any ideas/?
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

What kind of application are you using ? Is it a console-application ?

What exactly do you want to do ? Run the program and from within the program printing/displaying information on the console-screen ?
The command line arguments are alread passed as an array.

Module Module1
    Sub Main(ByVal args() As String)
        Dim i As Integer
        While i < args.Length
            Console.WriteLine(i.ToString() & ": " & args(i))
            i = i + 1
        End While
    End Sub
End Module

Open in new window

Avatar of GlobaLevel

ASKER

its not in the breadcrumb above..I am using vb.net...the vb.net will call a command line..thur process.start? and launch a program to run via dos..then it will run varaibles against it and that will produce a result which will then need to be inputed into a an array variable.....then..this is extra ..will be sent to a remote db for storage...
Hi GlobaLevel,
Sorry but than I do not understand what your question.
The variable 'args' in the code above is an array.
sorry..I must not be clear...

I am using vb.net to run a shell command against the DOS....the short is I need to glean the results from that and insert into variables...would this stil do?/
Module Module1
    Sub Main(ByVal args() As String)
        Dim i As Integer
        While i < args.Length
            Console.WriteLine(i.ToString() & ": " & args(i))
            i = i + 1
        End While
    End Sub
End Module
If I understand it correctly. You start a .net-application from the DOS-prompt with parameters.
You want to read those parameters into variables for further use in your application.

Imports System.Windows.Forms 
Module Module1


        Public Sub main()

            Dim frm As New Form1
            Dim str() As String
            Dim args() As String = Split(Command$," ")
            If (UBound(str) >= 0) Then
                a = str(0).ToString
                b = str(1).ToString
            End If
            Application.Run(frm)
        End Sub  

End Module

Open in new window

Dhaest~

I use vb.net to open a shell or MyProcess.start command....
Open an app with the shell that is using a vb.net
then read those values that are coming form the shell into varaibles...to be used in other parts of my vb.net program...
vb.net~~
    open DOs with Shell or MyProcess
          open app
                 dos returns values
           save values into a varaibles
    close shell
vb.net ~ takes those varibles into other parts of the vb.net program...
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial