private:
void linkLabel1_LinkClicked(System::Object ^ sender,
System::Windows::Forms::LinkLabelLinkClickedEventArgs ^ e)
{
try
{
VisitLink();
}
catch (Exception ^ ex)
{
MessageBox::Show("Unable to open link that was clicked.");
}
}
private:
void VisitLink()
{
// Change the color of the link text by setting LinkVisited
// to true.
linkLabel1->LinkVisited = true;
// Call the Process.Start method to open the default browser
// with a URL:
System::Diagnostics::Process::Start("http://www.microsoft.com");
}
now this works but only if there is 1 link label present. Unfortunately, I'm adding more than 1
This is the error it provides me
Compiler Error C2535
One way to do it is to use the same event handler for each linklabel. However to make this work you need to store the complete link(like http://google.de) in the linklabel text property. In the event handler you can use the following code.