Knowledge Base Nr: 00278 startprocess.cs - http://www.swe-kaiser.de

Downloads:

c#: mehrere links in linklabel-control / starten von prozessen

  
public Form1()
{
InitializeComponent();

linkLabel1.Text = "test für gif mp3 mpg";
linkLabel1.Links.Add(9, 3, @"C:\temp\grimassen.gif");
linkLabel1.Links.Add(13, 3, @"C:\temp\test.mp3");
linkLabel1.Links.Add(17, 3, @"C:\temp\test.mpg");
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
LinkLabel.Link link = e.Link;

Process.Start(link.LinkData.ToString());
}

private void DoCheck()
{
const string CHECKERTOOL = @".\tidy.exe";

try
{
Process checker = new Process();

checker.StartInfo.FileName = CHECKERTOOL;
checker.StartInfo.Arguments = String.Format("-e -f {0} \"{1}\"", "tidy.out", @".\test.html");
checker.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
checker.Start();
checker.WaitForExit();
}
catch (Win32Exception e)
{
MessageBox.Show("'" + CHECKERTOOL + "' can not be started!\n\n" + e.Message, "Process Error");
bOk = false;
}
}