'c# VS2022 .NET6 Open Hyperlink (Start Browser with URL)
I want to open a Hyperlink from C# (Visual Studio 2022, .NET 6). Unfortunatelly always an Excepttion is raised, althoug I followed exactly MS's docu: Start-Internet-Browser Thanks in advance for your help!, Jo
This fails: (Exception FFFF FFFF 8000 4005 / -2147467259 : "{"An error occurred trying to start process 'http://google.com' with working directory '...\net6.0-windows'. File not found."})
private void RichTextBoxMemo_LinkClicked(object sender, LinkClickedEventArgs e)
{
string url = e.LinkText;
try {
System.Diagnostics.Process.Start(url);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Problem with URL: '" + url + "'");
}
}
Solution 1:[1]
this will help you.
var uri = "https://stackoverflow.com/";
var psi = new System.Diagnostics.ProcessStartInfo
{
UseShellExecute = true,
FileName = uri
};
System.Diagnostics.Process.Start(psi);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shawn |
