Hi,
I am a beginner user to Visual Studio. I had written a Python script and convert the script to an executable file.
I am trying to use VS 2008 to create a user interface which will call to execute the python executable file. In order for the executable file to work, i need to add argument/parameter to the executable file. This is the part which i am not familiar with. Having source for information on google, i still cannot find one which i can easily understand based on my knowledge.
Basically when i run my Python script on a cmd, it will look like this:
so the UI i'm creating will hv a textbox and an open button click to look for the file and store in the textbox. Using another button click to run the argument and the executable file. The following code below is what i have.
WOuld be grateful if somebody could do a little help here for me. Thanks
I am a beginner user to Visual Studio. I had written a Python script and convert the script to an executable file.
I am trying to use VS 2008 to create a user interface which will call to execute the python executable file. In order for the executable file to work, i need to add argument/parameter to the executable file. This is the part which i am not familiar with. Having source for information on google, i still cannot find one which i can easily understand based on my knowledge.
Basically when i run my Python script on a cmd, it will look like this:
VB.NET:
C:\Python26>text.exe <file1.txt> <file2.txt> <file3.txt>
so the UI i'm creating will hv a textbox and an open button click to look for the file and store in the textbox. Using another button click to run the argument and the executable file. The following code below is what i have.
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strFileName As String
OpenFD.InitialDirectory = "C:\"
OpenFD.Title = "Open a Summary File"
OpenFD.Filter = "Summary Files|*.summary|Text Files|*.txt"
Dim DidWork As Integer = OpenFD.ShowDialog()
If DidWork = DialogResult.Cancel Then
Else
strFileName = OpenFD.FileName
TextBox1.AppendText(strFileName)
TextBox1.AppendText(" ")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim ChosenPlatform As String
Dim MyProg As String
'Dim x As String
Dim myParam As String
If RadioButton1.Checked = True Then
ChosenPlatform = RadioButton1.Text
MyProg = "C:\My Documents\Visual Studio 2008\Projects\Project1\test\test.exe"
myParam = Replace(TextBox1.Text, Chr(13), " ") ' replaces carriage returns with spaces
System.Diagnostics.Process.Start(MyProg, myParam)
TextBox1.Text = " "
End if
End Sub
WOuld be grateful if somebody could do a little help here for me. Thanks