Ejecutar aplicaciones externas a VB
Ejecutar aplicaciones externas a VB
En este Form se cargan programas externos a nuestra aplicación, el Form para VB.NET queda así:
PublicClass Form1
Private Sub BNotepad_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) HandlesBNotepad.Click
Process.Start("C:\Windows\System32\notepad.exe")
End Sub
Private Sub BConsola_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) HandlesBConsola.Click
Process.Start("C:\Windows\System32\cmd.exe")
End Sub
Private Sub BCalculadora_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) HandlesBCalculadora.Click
Process.Start("C:\Windows\System32\calc.exe")
End Sub
Private Sub BPowerpoint_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) HandlesBPowerpoint.Click
Process.Start("C:\Archivos de programa\Microsoft Office\Office14\POWERPNT.EXE")
End Sub
Private Sub BOutlook_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) HandlesBOutlook.Click
Process.Start("C:\Archivos de programa\Microsoft Office\Office14\OUTLOOK.EXE")
End Sub
Private Sub BWord_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) HandlesBWord.Click
Process.Start("C:\Archivos de programa\Microsoft Office\Office14\WINWORD.EXE")
End Sub
Private Sub BExcel_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) HandlesBExcel.Click
Process.Start("C:\Archivos de programa\Microsoft Office\Office14\EXCEL.EXE")
End Sub
End Class
Para C# solo agreguen la directiva using System.Diagnostics;
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Net;
usingSystem.Diagnostics;
namespaceWindowsFormsApplication1
{
public partial class Form2 : Form
{
publicForm2()
{
InitializeComponent();
}
privatevoid bNotepad_Click(objectsender, EventArgs e)
{
Process.Start(@"C:\\Windows\\System32\\notepad.exe");
}
privatevoid bConsola_Click(objectsender, EventArgs e)
{
Process.Start(@"C:\Windows\System32\cmd.exe");
}
privatevoid bCalculadora_Click(object sender, EventArgs e)
{
Process.Start(@"C:\Windows\System32\calc.exe");
}
privatevoid bPowerpoint_Click(objectsender, EventArgs e)
{
Process.Start(@"C:\Archivos de programa\Microsoft Office\Office14\POWERPNT.EXE");
}
privatevoid bOutlook_Click(objectsender, EventArgs e)
{
Process.Start(@"C:\Archivos de programa\Microsoft Office\Office14\OUTLOOK.EXE");
}
privatevoid bWord_Click(objectsender, EventArgs e)
{
Process.Start(@"C:\Archivos de programa\Microsoft Office\Office14\WINWORD.EXE");
}
privatevoid bExcel_Click(objectsender, EventArgs e)
{
Process.Start(@"C:\Archivos de programa\Microsoft Office\Office14\EXCEL.EXE");
}
}}
COMENTA LA PUBLICACION