| | |
Console Output
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
| View Poll Results: Why No Example Given For real Time Console Redirect | |||
| Microsoft my not be interested | | 1 | 100.00% |
| It may be under Developement | | 0 | 0% |
| It is avaliable, But not aware | | 0 | 0% |
| No Idea | | 0 | 0% |
| Voters: 1. You may not vote on this poll | |||
![]() |
•
•
Join Date: Apr 2007
Posts: 3
Reputation:
Solved Threads: 0
Hi all,
I want to redirect the console output in real time to a textbox. And if any standard error arrives or Process completed than i have to give one msgbox stating that process completed.Is there any method avalible.Presently I have this code.But it is not working properly
Thanks in Advance
Dana
I want to redirect the console output in real time to a textbox. And if any standard error arrives or Process completed than i have to give one msgbox stating that process completed.Is there any method avalible.Presently I have this code.But it is not working properly
vb Syntax (Toggle Plain Text)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.TextBox1.Text = String.Empty Dim clsProcess As New System.Diagnostics.Process() clsProcess.StartInfo.UseShellExecute = False clsProcess.StartInfo.RedirectStandardOutput = True clsProcess.StartInfo.RedirectStandardError = True clsProcess.StartInfo.FileName = "cmd dir/s" clsProcess.StartInfo.CreateNoWindow = True clsProcess.Start() While (clsProcess.HasExited = False) Dim sLine As String = clsProcess.StandardOutput.ReadLine If (Not String.IsNullOrEmpty(sLine)) Then Me.TextBox1.Text &= sLine & vbCrLf End If Application.DoEvents() End While Me.TextBox1.Text += "Completed" End Sub
Thanks in Advance
Dana
Last edited by danasegarane; Sep 7th, 2007 at 7:15 am.
•
•
Join Date: Sep 2007
Posts: 1
Reputation:
Solved Threads: 0
Hi
Your code is almost there. All that is required is to break apart the filename and add arguments. See below
p
Dim clsProcess As New System.Diagnostics.Process()
clsProcess.StartInfo.UseShellExecute = False
clsProcess.StartInfo.RedirectStandardOutput = True
clsProcess.StartInfo.RedirectStandardError = True
clsProcess.StartInfo.FileName = "cmd.exe"
clsProcess.StartInfo.Arguments = "dir /s"
clsProcess.StartInfo.CreateNoWindow = True
clsProcess.Start()
While (clsProcess.HasExited = False)
Dim sLine As String = clsProcess.StandardOutput.ReadLine
If (Not String.IsNullOrEmpty(sLine)) Then
End If
Me.TextBox1.Text &= sLine & vbCrLf
Application.DoEvents()
End While
Me.TextBox1.Text += "Completed"
Your code is almost there. All that is required is to break apart the filename and add arguments. See below
p
Dim clsProcess As New System.Diagnostics.Process()
clsProcess.StartInfo.UseShellExecute = False
clsProcess.StartInfo.RedirectStandardOutput = True
clsProcess.StartInfo.RedirectStandardError = True
clsProcess.StartInfo.FileName = "cmd.exe"
clsProcess.StartInfo.Arguments = "dir /s"
clsProcess.StartInfo.CreateNoWindow = True
clsProcess.Start()
While (clsProcess.HasExited = False)
Dim sLine As String = clsProcess.StandardOutput.ReadLine
If (Not String.IsNullOrEmpty(sLine)) Then
End If
Me.TextBox1.Text &= sLine & vbCrLf
Application.DoEvents()
End While
Me.TextBox1.Text += "Completed"
![]() |
Similar Threads
- Capturing Console Output (C)
- Redirecting console output to file (Java)
- Getting and displaying Output Debug messages to listbox (C#)
- Console Outpot Problems in Dev-C++ (C++)
Other Threads in the VB.NET Forum
- Previous Thread: allowing users to change image
- Next Thread: Server exception when opening a excel file in VB.net
Views: 4799 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 2008 access add application array assignment basic box button buttons center class click code combo convert cpu data database datagrid datagridview design designer dissertation dissertations dissertationthesis dosconsolevb.net editvb.net employees error excel exists firewall function image images isnumericfuntioncall listview login map math memory mobile module msaccess mssqlbackend mysql navigate net opacity page pan picturebox port print printing printpreview problem record refresh regex reports" reuse right-to-left save savedialog search serial socket sorting sql sqldatbase storedprocedure string structures studio temp textbox timer txttoxmlconverter upload useraccounts usercontol usercontrol vb vb.net vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet vista visual visualbasic visualbasic.net visualstudio2008 web wpf xml





