M
Marcus Kwok
I am having problems getting my LinkLabel hyperlink to work properly.
Every time I click on it, I get the following exception:
System.ComponentModel.Win32Exception: The requested lookup key was not found in any active activation context
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
I placed the LinkLabel on the form using the Designer and set the Text
property to what I want displayed. Then in the form's constructor,
after the call to InitializeComponent(), I set the LinkData property:
linklabel_zlib->Links->Item[0]->LinkData = S"http://www.zlib.net/";
and my LinkLabel Clicked event handler looks like:
System::Void linkLabel_LinkClicked(Object * sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs * e)
{
using System::String;
using System::Windows::Forms::LinkLabel;
LinkLabel* link = __try_cast<LinkLabel*>(sender);
link->Links->Item[link->Links->IndexOf(e->Link)]->Visited = true;
String* target = __try_cast<String*>(e->Link->LinkData);
System:iagnostics:rocess::Start(target);
}
In the debugger, I have verified that "target" indeed holds the correct
URI.
I have also tried commenting this out and explicitly using the URI:
System::Void linkLabel_LinkClicked(Object * sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs * e)
{
System:iagnostics:rocess::Start(S"http://www.zlib.net/");
}
but I get the same exception.
Not sure if it's relevant, but my default browser is Mozilla Firefox.
This is on Windows XP Pro SP 2, .NET Framework 1.1, and VS .NET 2003.
Thanks for any hints.
Every time I click on it, I get the following exception:
System.ComponentModel.Win32Exception: The requested lookup key was not found in any active activation context
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
I placed the LinkLabel on the form using the Designer and set the Text
property to what I want displayed. Then in the form's constructor,
after the call to InitializeComponent(), I set the LinkData property:
linklabel_zlib->Links->Item[0]->LinkData = S"http://www.zlib.net/";
and my LinkLabel Clicked event handler looks like:
System::Void linkLabel_LinkClicked(Object * sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs * e)
{
using System::String;
using System::Windows::Forms::LinkLabel;
LinkLabel* link = __try_cast<LinkLabel*>(sender);
link->Links->Item[link->Links->IndexOf(e->Link)]->Visited = true;
String* target = __try_cast<String*>(e->Link->LinkData);
System:iagnostics:rocess::Start(target);
}
In the debugger, I have verified that "target" indeed holds the correct
URI.
I have also tried commenting this out and explicitly using the URI:
System::Void linkLabel_LinkClicked(Object * sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs * e)
{
System:iagnostics:rocess::Start(S"http://www.zlib.net/");
}
but I get the same exception.
Not sure if it's relevant, but my default browser is Mozilla Firefox.
This is on Windows XP Pro SP 2, .NET Framework 1.1, and VS .NET 2003.
Thanks for any hints.