0

I am currently trying to call a program from VB.Net that uses some command line switches. The following is the code I am using. The problems is that I get the error: "No application is associated with the specified file for this operation."

CODE:

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try
Dim wsh
wsh = CreateObject("WScript.Shell")
wsh.Run(Directory.GetCurrentDirectory + "\GetSigw.exe /3 " + Directory.GetCurrentDirectory + "\SigAVA.bmp", 0, 1)
Catch ex As Exception
MessageBox.Show(ex.Message)

End Try
End Sub

Any help would much appreciated.

Thanks

Larry

2
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by dbarcode
0

Have you checked to see that directory.getcurrentdirectory is returning the proper path, or returning anything at all? Also, After some long hours of headache and painful study, Visal and I found that passing data to WSH's Run Method that contains spaces (in VB6, We Tried App.Path ) forces it to error, because it doesn't properly render the spaces. A Solution for you to look into is:


Dim myProcess As Process = System.Diagnostics.Process.Start(Directory.GetCurrentDirectory + "\GetSigw.exe /3 " + Directory.GetCurrentDirectory + "\SigAVA.bmp")

or something similar and along those lines. The WSH's Run Method is great, if you can throw in a bunch of chr(34)'s around your directory.getcurrentdirectory's, but I think this procedure will be more effective for you.

This article has been dead for over six months. Start a new discussion instead.
Be sure to adhere to our posting rules.