I m new to vb programming.
How do i get the details which
come when we type net session
on the command prompt into
a vb program ?

how about something like this...

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Const SW_HIDE = 0

Private Sub Command1_Click()
Open "C:\test.bat" For Output As #1
Print #1, "net session > view.txt"
Close #1

ShellExecute Me.hwnd, "open", "test.bat", "", "C:\", SW_HIDE
Sleep 20 ' wait for file to get created!!!
Open "C:\view.txt" For Input As #1
Text1.Text = ""
Do Until EOF(1)
Line Input #1, fdata$
Text1.Text = Text1.Text + fdata$ + vbNewLine
Loop

Close #1

Kill "C:\view.txt"

End Sub

The only way I know of off hand is to use API to define a process, hook into it, and set its STDOUT to a stream, that you can read. That would take a WHOLE lot of API programming, and is likely not going to be an acceptible answer for a VB programmer (it wouldn't be for me).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.