G
Guest
Hi friends:
I am using Visual Basic Express 2005 (just migrated from vb6) and I
have come across a strange conumdrum:
I am doing a process start and then it waits for it to finish before
moving on.
The reason I do this is because I have software written in old archaic
languages and I dont have access to the source code so good ole batch
will have to do. Note I am using a BATCH file, not an exe.
This BATCH file calls the proprietary software passing in command line
arguments.
My code is as follows:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnRun.Click
PATH = txtPATH.Text
Call WriteSATfile()
MessageBox.Show("DONE") 'this is to check that this line of
code doesnt execute before the process completes
End Sub
Public Sub WriteSATfile()
Dim p As Process
'open the file and close it
'this makes sure that if it was already filled with data it
will be killed
Dim FreeFNum As Integer = FreeFile()
FileOpen(FreeFNum, FPath & "\" & "temp.bat", OpenMode.Output)
FileClose(FreeFNum)
FileOpen(FreeFNum, FPath & "\" & "temp.bat", OpenMode.Append)
PrintLine(FreeFNum, "PATH=%path%;" & PATH)
PrintLine(FreeFNum, "CALL DORUNSKIM") 'this is the batch file
I am calling
FileClose(FreeFNum)
Dim temp As String
p = Process.Start( FPath & "\" & "temp.bat")
p.WaitForExit()
End Sub
The conumdrum happens to be this: If I use the debug mode in Visual
Basic Express 2005, the code does not work! However, if I actually
build this code, it runs!!! why is that?
Many thanks for any help the experts out there can give.
I am using Visual Basic Express 2005 (just migrated from vb6) and I
have come across a strange conumdrum:
I am doing a process start and then it waits for it to finish before
moving on.
The reason I do this is because I have software written in old archaic
languages and I dont have access to the source code so good ole batch
will have to do. Note I am using a BATCH file, not an exe.
This BATCH file calls the proprietary software passing in command line
arguments.
My code is as follows:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnRun.Click
PATH = txtPATH.Text
Call WriteSATfile()
MessageBox.Show("DONE") 'this is to check that this line of
code doesnt execute before the process completes
End Sub
Public Sub WriteSATfile()
Dim p As Process
'open the file and close it
'this makes sure that if it was already filled with data it
will be killed
Dim FreeFNum As Integer = FreeFile()
FileOpen(FreeFNum, FPath & "\" & "temp.bat", OpenMode.Output)
FileClose(FreeFNum)
FileOpen(FreeFNum, FPath & "\" & "temp.bat", OpenMode.Append)
PrintLine(FreeFNum, "PATH=%path%;" & PATH)
PrintLine(FreeFNum, "CALL DORUNSKIM") 'this is the batch file
I am calling
FileClose(FreeFNum)
Dim temp As String
p = Process.Start( FPath & "\" & "temp.bat")
p.WaitForExit()
End Sub
The conumdrum happens to be this: If I use the debug mode in Visual
Basic Express 2005, the code does not work! However, if I actually
build this code, it runs!!! why is that?
Many thanks for any help the experts out there can give.