Problem with executing external exe

soulwraith

New member
Joined
Aug 5, 2009
Messages
2
Programming Experience
Beginner
I am executing external exe from vb.net, but i m not getting output value which exe return after executing.

Below is my code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

System.Diagnostics.Process.Start("C:\Users\soulwraith1\Desktop\FileTransfer\Server\Server\bin\Debug\Server.exe")

End Sub

i need to use the server.exe to create a txt file with some information inside, but it wont create if i executing the exe from a vb.net window form.

when i run that exe through command prompt it works fine and create the txt file as expected.


pls help.THX!!
 
You most likely have to set the working directory. Create a Process instance and set its StartInfo properties, then call the Start method. See the code sample in help if you need to: Process Class (System.Diagnostics)

Not sure what you put in "output value", if you mean the exit code or the file output.
 
basically i just want to create a window form that when a button is clicked it will open a console application, the console application will create a txt file, but now the problem is the console application wont work(txt file not created) if it is called from the window form .

Here is the code of the console application:
Sub Main()
Dim TextFile As New StreamWriter("test.txt")

TextFile.WriteLine("Line 1")
TextFile.WriteLine("wwwsaddsasadsags.com")

TextFile.Close()
Console.WriteLine("Text File created test.txt")
End Sub


And the code of the window form: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


System.Diagnostics.Process.Start("C:\ConsoleApplication.exe")

End Sub
 
Back
Top