BANNER

Seo Services

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í:

Public Class Form1
    Private Sub BNotepad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BNotepad.Click
        Process.Start("C:\Windows\System32\notepad.exe")
    End Sub
    Private Sub BConsola_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BConsola.Click
        Process.Start("C:\Windows\System32\cmd.exe")
    End Sub
    Private Sub BCalculadora_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BCalculadora.Click
        Process.Start("C:\Windows\System32\calc.exe")
    End Sub
    Private Sub BPowerpoint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BPowerpoint.Click
        Process.Start("C:\Archivos de programa\Microsoft Office\Office14\POWERPNT.EXE")
    End Sub
    Private Sub BOutlook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BOutlook.Click
        Process.Start("C:\Archivos de programa\Microsoft Office\Office14\OUTLOOK.EXE")
    End Sub
    Private Sub BWord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BWord.Click
        Process.Start("C:\Archivos de programa\Microsoft Office\Office14\WINWORD.EXE")
    End Sub
    Private Sub BExcel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BExcel.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;


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Diagnostics;
namespace WindowsFormsApplication1
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        private void bNotepad_Click(object sender, EventArgs e)
        {
             Process.Start(@"C:\\Windows\\System32\\notepad.exe");
        }
        private void bConsola_Click(object sender, EventArgs e)
        {
            Process.Start(@"C:\Windows\System32\cmd.exe");
        }
        private void bCalculadora_Click(object sender, EventArgs e)
        {
             Process.Start(@"C:\Windows\System32\calc.exe");
        }
        private void bPowerpoint_Click(object sender, EventArgs e)
        {
        Process.Start(@"C:\Archivos de programa\Microsoft Office\Office14\POWERPNT.EXE");
        }
        private void bOutlook_Click(object sender, EventArgs e)
        {
            Process.Start(@"C:\Archivos de programa\Microsoft Office\Office14\OUTLOOK.EXE");
        }
        private void bWord_Click(object sender, EventArgs e)
        {
         Process.Start(@"C:\Archivos de programa\Microsoft Office\Office14\WINWORD.EXE");
        }
        private void bExcel_Click(object sender, EventArgs e)
        {
           Process.Start(@"C:\Archivos de programa\Microsoft Office\Office14\EXCEL.EXE");
        }   
        }}

No hay comentarios