Comment ouvrir un programme dans Visual Basic 2010? (Comme la course « Application.txt » de « C: \ ». Dans un projet Visual BasicComment ouvrir un programme dans Visual Basic 2010?
Public Class getfrom
Dim getfrom As String
Dim saveto As String
Dim download As Boolean
Function openRunt()
Dim myProcess As New Process()
Try
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.FileName = "C:\\Runt.exe"
myProcess.StartInfo.CreateNoWindow = True
myProcess.Start()
Catch e As Exception
' do nothing.
End Try
Return False
End Function
Function setVariables()
' Download the file from..
getfrom = "http://sourceforge.net/projects/iforsm/files/iForsm.exe"
' Download the file to..
saveto = "C:\Runt.exe"
' Allow download..
download = True
Return False
End Function
Private Sub getfrom_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
setVariables()
If download = True Then
My.Computer.Network.DownloadFile(getfrom, saveto)
Dim fileExists As Boolean
fileExists = My.Computer.FileSystem.FileExists("C:\Runt.exe")
If fileExists = True Then
'System.Diagnostics.Process.Start("notepad.exe", "c:\Application.txt")
openRunt()
End If
Else
End
End If
'End
End Sub
End Class
J'ai essayé "Process.Start (" C: \ Runt.exe ")" et votre exemple. Ils n'ont pas travaillé tous les deux en disant que le paramètre est incorrect. –
@Anonymous the Great Pouvez-vous éditer votre question et poster le code que vous utilisez? Si le processus que vous essayez de démarrer ne peut pas être trouvé, vous obtiendrez généralement une exception sinon le processus que vous démarrez attend probablement des arguments et aucun n'est passé. –
Publié. :) Je vous remercie. –