0

I am trying to use a LinkLabel to direct users of my program to my Discord server (so they can report bugs and whatnot), but every time I click on it I get an error saying 'The system cannot find the file specified.'

I was using Process.Start("INVITE LINK") as that was the code I found in the vast majority of results I got when I Googled the issue. However, it would seem that this doesn't work in Visual Studio 2019, as evidenced by the error I get. Either that, or I've overlooked something (which wouldn't be the first time, as I kind of have a habit of not reading things properly).

I'm sure I've managed it before, but I can't for the life of me remember how it was done; I'm asking here in the hope that someone can push me in the right direction. Thanks in advance.

djv
  • 15,168
  • 7
  • 48
  • 72
  • 1
    What is the error you get? [this](https://stackoverflow.com/a/4580317/832052) should just work. – djv Nov 17 '21 at 20:44
  • 'The system cannot find the file specified.' – GeodesicDragon Nov 17 '21 at 21:30
  • That answer you linked me to didn't work; it's for C# and I'm using Visual Basic. – GeodesicDragon Nov 17 '21 at 21:43
  • In Windows go to Predefined Programs and check if the (predefined) Browser is correct. If it's correct then it's something wrong in your "INVITE LINK", should start with http://yourSite, maybe you are trying to open some local file like "C:\somethingThatDoesntExist.html" – Miguel Nov 17 '21 at 22:17
  • The link starts with `https://discord.gg/(invite code goes here)`. The predefined (I assume that means default) browser is Firefox. – GeodesicDragon Nov 17 '21 at 22:45
  • The following may be helpful: https://stackoverflow.com/questions/39626509/how-to-launch-ms-edge-from-c-sharp-winforms – Tu deschizi eu inchid Nov 18 '21 at 02:33

1 Answers1

1

Taken from an answer in c#,

using System.Diagnostics;
Process myProcess = new Process();
myProcess.StartInfo.UseShellExecute = true; 
myProcess.StartInfo.FileName = "https://discord.gg/(invite code goes here)";
myProcess.Start();

It's not much different in vb

Imports System.Diagnostics
Dim myProcess = New Process()
myProcess.StartInfo.UseShellExecute = True
myProcess.StartInfo.FileName = "https://discord.gg/(invite code goes here)"
myProcess.Start()
djv
  • 15,168
  • 7
  • 48
  • 72