Lancer une application

Résolu
bolobo46 Messages postés 155 Statut Membre -  
karirovax Messages postés 3584 Statut Membre -
Bonjour,
J'aimerais savoir comment lancer une application a partir d'une commande :

If RichTextBox1.Text = "écrire" Then MsgBox("Voulez vous NOTEPAD ou OPENOFFICE ?")
If RichTextBox1.Text = "notepad" Then (je ne sais pas quoi mettre ici pour lancer le bloc note)

merci d'avance :)

1 réponse

  1. karirovax Messages postés 3584 Statut Membre 215
     
    voici un exemple qui lance la commande ipconfig

    Imports System.IO
        Public Class Form1
            Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
                ' Setting some of the process information
                Dim start_info As New ProcessStartInfo("C:\WINDOWS\system32\ipconfig")
                start_info.UseShellExecute = False
                start_info.CreateNoWindow = True
                start_info.RedirectStandardOutput = True
                start_info.RedirectStandardError = True
         
                ' Construct the argument for the process
                start_info.Arguments = "/all"
         
                ' Create the new process, set its start information and execute the process
                Dim proc As New Process()
                proc.StartInfo = start_info
                proc.Start()
         
                ' Attach to stdout and stderr.
                Dim std_out As StreamReader = proc.StandardOutput()
                Dim std_err As StreamReader = proc.StandardError()
         
                ' Display the results.
                RichTextBox1.Text = std_out.ReadToEnd() & std_err.ReadToEnd()
         
                ' Clean up.
                std_out.Close()
                std_err.Close()
                proc.Close()
         
            End Sub
        End Class
    

    0