Tuesday, 19 April 2011

Iniciar un programa en C# y VB.NET

C#


using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
class MyProcess
{
public static void Main()
{
Process myProcess = new Process();

try
{
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.FileName = "C:\\ejecutable.exe";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();

}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}





VB.NET


Imports System
Imports System.Diagnostics
Imports System.ComponentModel


Namespace MyProcessSample

Class MyProcess

Public Shared Sub Main()
Dim myProcess As New Process()

Try

myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.FileName = "C:\\ejecutable.exe"
myProcess.StartInfo.CreateNoWindow = True
myProcess.Start()

Catch e As Exception
Console.WriteLine((e.Message))
End Try
End Sub
End Class
End Namespace




Publicado en tttony.blogspot.com

No comments:

Post a Comment