Hello everyone. I am getting a strange unhandled exception when I click the linklabel which should open a form. I have tried to put the code in linklabel_click event handler in try-catch block, but I still get the error below.
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
********** Exception Text ********** System.ComponentModel.Win32Exception: The system cannot find the file specified 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) at InfoCapsule.FrmLink.llblHelp_LinkClicked(Object sender, LinkLabelLinkClickedEventArgs e) at System.Windows.Forms.LinkLabel.OnLinkClicked(LinkLabelLinkClickedEventArgs e) at System.Windows.Forms.LinkLabel.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Label.WndProc(Message& m) at System.Windows.Forms.LinkLabel.WndProc(Message& msg) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
The code for linklabel_click is as under.
private void llblHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try
{
refFrmHelp = new FrmHelp(this);
refFrmHelp.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Code inside FrmHelp
String sitePath = null;
try
{
sitePath = "file:///" + Application.StartupPath + "\\help.html";
//sitePath = sitePath.Replace("\\", "/");
MessageBox.Show(sitePath);
Uri path = new Uri(sitePath);
wbHelp.Navigate(path);
}
catch (UriFormatException ex)
{
MessageBox.Show(ex.ToString() + "\nSite Path: " + sitePath);
return false;
}
catch (Exception exp)
{
MessageBox.Show(exp.ToString() + "\nSite Path: " + sitePath);
return false;
}
Can you please help me in debugging.