Click here to Skip to main content
16,005,138 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: "out-of-paper" error Pin
Anonymous28-Apr-05 5:55
Anonymous28-Apr-05 5:55 
GeneralRe: "out-of-paper" error Pin
lmaks2-May-05 4:00
lmaks2-May-05 4:00 
GeneralDatagrid Control Pin
nitin_ion27-Apr-05 22:54
nitin_ion27-Apr-05 22:54 
GeneralVS.2005 no datagridtablestyle Pin
Greeky27-Apr-05 22:44
Greeky27-Apr-05 22:44 
GeneralRe: VS.2005 no datagridtablestyle Pin
Anonymous28-Apr-05 3:20
Anonymous28-Apr-05 3:20 
GeneralReading text from command prompt Pin
johnjsm27-Apr-05 22:31
johnjsm27-Apr-05 22:31 
GeneralRe: Reading text from command prompt Pin
Fernando Soto28-Apr-05 10:37
Fernando Soto28-Apr-05 10:37 
GeneralRe: Reading text from command prompt Pin
Fernando Soto4-May-05 6:23
Fernando Soto4-May-05 6:23 
Hi;

There is a better way to redirect the output of a DOS program which I cam across in my readings. And that is using the Process object. Here is what I did to test it.

Imports System.ComponentModel

Private ERROR_FILE_NOT_FOUND As Integer = 2
Private ERROR_ACCESS_DENIED As Integer = 5

Dim myProcess As Process = New Process

Try
Dim prgOutput As String ‘ Output from DOS program
Dim strSplit() As String = Nothing
Dim delimStr As String = Chr(13) & Chr(10)
Dim delimiter() As Char = delimStr.ToCharArray()

myProcess.StartInfo.FileName = tbPath.Text ‘Full pathname to including file name
myProcess.StartInfo.Arguments = tbOptions.Text ‘ If the program takes args as string
myProcess.StartInfo.CreateNoWindow = True ‘ Does not create a window DOS program
myProcess.StartInfo.UseShellExecute = False ‘ Must be false to redirect output
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start() ‘ Start the DOS program
myProcess.WaitForExit() ‘ Wait until it completes before moving on
prgOutput = myProcess.StandardOutput.ReadToEnd ‘ Get the DOS output
prgOutput = prgOutput.Replace(delimiter, "|")
strSplit = prgOutput.Split("|"c)
For i As Integer = 0 To (strSplit.Length - 1)
lbOutput.Items.Add(strSplit(i))
Next
Catch ex As Win32Exception
If ex.NativeErrorCode = ERROR_FILE_NOT_FOUND Then
Console.WriteLine((ex.Message + ". Check the path."))
Else
If ex.NativeErrorCode = ERROR_ACCESS_DENIED Then
' Note that if your word processor might generate exceptions
' such as this, which are handled first.
Console.WriteLine((ex.Message + ". You do not have permission to print this file."))
End If
End If
End Try


GeneralProblems with the debugger in VB.Net Pin
Johtrek27-Apr-05 21:54
Johtrek27-Apr-05 21:54 
GeneralRe: Problems with the debugger in VB.Net Pin
Nostra27-Apr-05 22:15
Nostra27-Apr-05 22:15 
GeneralRe: Problems with the debugger in VB.Net Pin
Johtrek27-Apr-05 22:46
Johtrek27-Apr-05 22:46 
GeneralRe: Problems with the debugger in VB.Net Pin
rwestgraham28-Apr-05 7:20
rwestgraham28-Apr-05 7:20 
GeneralRunning project from nmetwork Pin
nitin_ion27-Apr-05 21:27
nitin_ion27-Apr-05 21:27 
GeneralAT Commands Pin
aqui_i27-Apr-05 20:26
aqui_i27-Apr-05 20:26 
Questionhow to clear ComboBox text Pin
Anonymous27-Apr-05 20:12
Anonymous27-Apr-05 20:12 
Answerhow to clear ComboBox text(here my code need solution) Pin
Anonymous27-Apr-05 20:24
Anonymous27-Apr-05 20:24 
GeneralRe: how to clear ComboBox text(here my code need solution) Pin
Anonymous28-Apr-05 6:01
Anonymous28-Apr-05 6:01 
GeneralRe: how to clear ComboBox text(here my code need solution) Pin
Anonymous29-Apr-05 19:38
Anonymous29-Apr-05 19:38 
GeneralRuntime Exceptions Pin
genius12327-Apr-05 18:54
genius12327-Apr-05 18:54 
GeneralRe: Runtime Exceptions Pin
Dave Kreskowiak28-Apr-05 4:25
mveDave Kreskowiak28-Apr-05 4:25 
GeneralSaving word file in Oracle Pin
hkpillai27-Apr-05 18:45
hkpillai27-Apr-05 18:45 
GeneralCrystal reports installation Pin
realbenefits27-Apr-05 18:19
realbenefits27-Apr-05 18:19 
GeneralRe: Crystal reports installation Pin
Joey Picerno28-Apr-05 16:50
Joey Picerno28-Apr-05 16:50 
GeneralRe: Crystal reports installation Pin
realbenefits28-Apr-05 20:31
realbenefits28-Apr-05 20:31 
GeneralRe: Crystal reports installation Pin
Joey Picerno29-Apr-05 3:52
Joey Picerno29-Apr-05 3:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.