Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.net application calling fortran exe

Status
Not open for further replies.

desaivar

Programmer
Jul 6, 2009
12
0
0
US
Hi there,

Please urgent help required for below issue.

I am running one fortran exe in .net application(calling from command line with the help of system diagnostic process).

If we directly click on fortran exe, it shows inputs to enter for fortran in command window, after input entered it gets executed. We want same behaviour but want to run fortran exe from .net application, If we click on button in vb.net form, this exe should get called and should show inputs to enter on the command line, once inputs entered it should execute. How to achieve this with .net application?

Right now, after clicking on button in vb.net form, exe get's opened in command window, but it is blank, and gets hanged.
Below is the error

forrtl: error (200): program aborting due to window-CLOSE event Image PC Routine Line Source
R540CS.exe 004622DA Unknown Unknown Unknown
R540CS.exe 0045F4C8 Unknown Unknown Unknown
R540CS.exe 00421A8E Unknown Unknown Unknown
R540CS.exe 00432154 Unknown Unknown Unknown
kernel32.dll 7C87655C Unknown Unknown Unknown
kernel32.dll 7C80B729 Unknown Unknown Unknown



Here is the code used,

Dim ProcArgs As String = String.Empty
Dim procInfo As ProcessStartInfo = Nothing
Dim myErrstreamReader As StreamReader = Nothing
Dim flag As Boolean = False
Dim strErrFileMsg As String = String.Empty
Try

ProcArgs = String.Format("""{0}""", strInputFile)

procInfo = New ProcessStartInfo
procInfo.FileName = ExeFile
procInfo.CreateNoWindow = False
procInfo.UseShellExecute = False
procInfo.RedirectStandardError = True


Using process As Process = process.Start(procInfo)
process.WaitForExit()
myErrstreamReader = process.StandardError
strErrFileMsg = myErrstreamReader.ReadToEnd.ToString
End Using
 
I have not tried calling VB.Net from Fortran (In fact it has been a life time since doing any Fortran) so I am making some uninformed suggestions here. Do you have other places in the code that do work? If not may I suggest you start by creating some simple example test calls and build up to the version that has the issue. Wish I could be of more help, or even better someone answers you with a real solution.

Lion Crest Software Services
Anthony L. Testi
President
 
Have you ttried googling for help? Also, take a look at the shell command. You can use it to run external programs. Seems easier to use than system.diagnostics.processstart (or what ever the syntax is).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top