S
Sooraj
Hi,
I'm a mechanical engineer new to programming. I was trying to write a
program in Visual Basic Express Edition 2005. I want to run a file
using an application called madymo601 in command prompt.
Normally what I do is to go to Start> Run> and type cmd /k madymo601 c:
\filename.xml . I have put the /k there as i need the cmd window open
after execution to view the results. I tried to make a small VB
program to avoid typing in the commands since the .xml files I need to
run could be in various locations. I wrote a code as given below. But
seems to have something wrong with the diagnostics.process.start line.
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
OpenFileDialog1.Title = "Please select .xml file"
OpenFileDialog1.Filter = "xml files|*.xml"
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName <> "" Then
TextBox1.Text = (OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim filepath As String = (TextBox1.Text)
Diagnostics.Process.Start("cmd /k madymo601", filepath)
End Sub
Hope someone could help me out with the right way to do this.
Thanx.
I'm a mechanical engineer new to programming. I was trying to write a
program in Visual Basic Express Edition 2005. I want to run a file
using an application called madymo601 in command prompt.
Normally what I do is to go to Start> Run> and type cmd /k madymo601 c:
\filename.xml . I have put the /k there as i need the cmd window open
after execution to view the results. I tried to make a small VB
program to avoid typing in the commands since the .xml files I need to
run could be in various locations. I wrote a code as given below. But
seems to have something wrong with the diagnostics.process.start line.
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
OpenFileDialog1.Title = "Please select .xml file"
OpenFileDialog1.Filter = "xml files|*.xml"
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName <> "" Then
TextBox1.Text = (OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim filepath As String = (TextBox1.Text)
Diagnostics.Process.Start("cmd /k madymo601", filepath)
End Sub
Hope someone could help me out with the right way to do this.
Thanx.