1.

Solve : Check this code for me????

Answer»

hi ll,

I've have some vb.net (2005) code that I've written below,

It SEEMS to display that it can't find the file in the status listbox. This to me seems strange as the 2 batch files that it uses are indeed there and named right,

Could someone please just PASS an eye over this code for me to make sure i haven't MADE some school boy error!

Code: [Select]Imports system.io

Public CLASS formtest
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles testrun.Click

'writes box1.text to a txt file for go.bat to import
Shell("c:\2go.bat " + box1.Text)
' Set start information.
Dim start_info As New ProcessStartInfo("c:\3go.bat")
With start_info
.UseShellExecute = False
.CreateNoWindow = True
.RedirectStandardOutput = True
.RedirectStandardError = True
End With
' Make the process and set its start information.
Dim batch As New Process()
batch.StartInfo = start_info

' Start the process.
batch.Start()

' Attach to stdout and stderr / display.
Dim std_out As StreamReader = batch.StandardOutput()
Dim std_err As StreamReader = batch.StandardError()
Dim display = std_out.ReadLine + std_err.ReadLine
' Display the results.

Formstatus.statuslist.HorizontalScrollbar = True
Formstatus.statuslist.Items.Add(display)
Formstatus.Show()


Me.Close()


' Clean up.
std_out.Close()
std_err.Close()
batch.Close()

cheers guys



Discussion

No Comment Found