2

This is my simple code, yet it throws me an exception for some reason

 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start("chrome", "https://www.google.com/"); } 

The Exception:

System.ComponentModel.Win32Exception: 'The system cannot find the file specified.' 

I don't understand why this is happening

2
  • specify your tags : add 'WinForms' and which version of .Net you are using, so the community can help you efficiently. Commented May 7, 2021 at 1:58
  • apparently i am using .NET v4.0 Commented May 7, 2021 at 2:05

1 Answer 1

1

To open a url using the WinForms's linkLabel component do

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start("http://www.url.com"); // will automaticaly redirect the user to his default web browser } 

find more in the official documentation.
take a look there : already answered question.
good luck.

Sign up to request clarification or add additional context in comments.

1 Comment

In .Net Framework (since UseShellExecute = true by default). In .Net Core / .Net 5+, it defaults to UseShellExecute = false. So you have to set it to true beforehand.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.