HelpFile contents are not opened

1k Views Asked by At

I have an applications that install two other application which has a "Help" option. Each of these application has a common help file but the contents should be displayed based on the index selected for the application in the "Table of Contents". If i open one application, the help of that particular application should be displayed.

My code looks like this for Appl1.

    private void Help_Click(Core.CommandBarButton Ctrl, ref bool CancelDefault)
    {
        if (System.IO.File.Exists(new PlugInConstants().HELP_FILE_Path))
        {                
            System.Windows.Forms.Help.ShowHelp(new System.Windows.Forms.Control(),
                new PlugInConstants().HELP_FILE_Path,
                System.Windows.Forms.HelpNavigator.TableOfContents, "Appl1");
        }
        else
        {
            System.Windows.Forms.MessageBox.Show(m_objLanguage.ERR_HELP_NOT_FOUND.Replace
                ("%1", m_objGlobalConfig.HelpFilename));
        }

        CancelDefault = false;
    }

and looks like this for Appl2

  private void HelpToolStripMenuItem_Click(object sender, EventArgs e)
    {
        helpToolStripMenuItem.Enabled = false;   
        string helpFilePath;
        helpFilePath = new TrayConstants().HELP_FILE_Path;

        if (System.IO.File.Exists(helpFilePath))
        {
            System.Windows.Forms.Help.ShowHelp(new System.Windows.Forms.Control(), 
                helpFilePath, System.Windows.Forms.HelpNavigator.TableOfContents, "Appl2") ;
        }
        else
        {
            if (m_helpPage == null)
                m_helpPage = new HelpPage();
            m_helpPage.ShowDialog();
        }

       helpToolStripMenuItem.Enabled = true;
    }

from this i can only see the Content page of common helpfile, but not the particular application help that is selected. Now i did run Appl1 but still i can see the main MyAppbut not Appl1that is automatically selected and the contents that is displayed to right.

the !st screen in the image is what i am getting now, but i need the second screen

I am using VS 2010,C#, win forms thanks in advance

1

There are 1 best solutions below

5
On

I believe that your issue is that you are accessing the wrong value in the HelpNavigator enum. Looks like it should be Topic, not TableOfContents.

System.Windows.Forms.Help.ShowHelp(new System.Windows.Forms.Control(), 
                helpFilePath, System.Windows.Forms.HelpNavigator.Topic, "Appl2") ;

http://msdn.microsoft.com/en-us/library/system.windows.forms.helpnavigator.aspx