C# .NET - How to use help file in .Net 2.0? - Asked By Eswaran Radhakrishnan on 17-Nov-08 03:46 AM

Hi all,

I need to use some help file in my windows application when the user press key "F1". I need to show up the help file as separte window.

How to do that?

Thanks

R. Eswaran

Re :: Using Help in Asp.Net on Pressing F1 - SP replied to Eswaran Radhakrishnan on 17-Nov-08 03:55 AM

You can simply use the following code:
 
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body onhelp="window.showHelp('http://www.google.com');return false">
    Press F1 to see the help file
</body>
</html>
 
Hope it helps.

Re :: Using Help in Asp.Net on Pressing F1 - SP replied to Eswaran Radhakrishnan on 17-Nov-08 03:56 AM

See the following articles for more details on creating help in asp.net

http://forums.asp.net/p/1304208/2560066.aspx

http://www.codeproject.com/KB/dotnet/HelpIntegrationInDotNet.aspx

Hope it helps.

re - Web Star replied to Eswaran Radhakrishnan on 17-Nov-08 03:57 AM

Help for controls

The Windows Forms supports a "What's this .." HelpButton and / or F1-Help on individual controls based on Help files. To attach Help topics within a Help file (that is either HTML or HTMLHelp 1.x/Help 2.x format) to specific controls on Windows Forms you need to use the HelpProvider component. The HelpProvider component will associates an HTMLHelp 1.x Help file (CHM) or a single HTML file with your Windows Form application.

The HelpButton will be located on the right side of the title bar and can be accessed through the HelpButton property. To include the Help Button on your form requires that the MinimizeBox and MaximizeBox property of the form (!) is set to "False" and the HelpButton to "True".

To provide this Help in your application, you have to use the HelpProvider control which you can find in the Toolbox on the Windows Forms tab. Drag and Drop a HelpProvider component from the Toolbox to your form. It is a component rather than a control, so when you put it on your form it will sit in the component tray below. Rename this component to "hlpHtmlLocal". This component gives every control on the form three new properties called HelpKeyword, HelpNavigator and HelpString on hlpProvider1.

If necessary (e.g. my example) drag and drop two more HelpProvider components to your form and rename them to "hlpProvider1" and "hlpHtmlServer".


Creating Help for a form, a dialog or control with HTML files

Properties to display help (HTML file - local )

Activate the hlpProvider component hlpHtmlLocal and set the HelpNameSpace property of hlpHtmlLocal to the file name you want to work with.

We open a local HTML file with the dialog using the little button to the right.

The next step is to set the HelpNavigator property of a control (e.g. button) to a value of the HelpNavigator enumeration (see table below). Here we use Topic.

When the application is running click the HelpButton to enable "What's this .." Help. The cursor changes. Now click the button or press F1 when the button has focus. This will open the single HTML file in your browser.

It seems you can't use anchor names to jump to a specific part of your HTML file.

Properties to display help (HTML file - Server http://..)

Activate the hlpProvider component and set the HelpNameSpace property of hlpHtmlServer to the file name you want to work with. Here we use a http:// address of a single HTML file. If you provide the file on your company server, you don't have to update the help file with the customer.

The next step is to set the HelpNavigator property of a control (e.g. button) to a value of the HelpNavigator enumaration (see table below). Here we use Topic. Then we set the HelpKeyword on hlpHtmlSever property to e.g. "anchor3". Don't add a leading "#". Leave it empty if you want to open a HTML file without anchors. The Help Handles cmdControl2.Click Dim sHelpFile As String Dim sStartupPath As String '--- Initialize context-sensitive help --- Keyword property provides the key information to retrieve the help associated with the control.

When the application is running click the HelpButton to enable "What's this .." Help. The cursor changes. Now click the button or press F1 when the button has focus. This will open the single HTML file over the Internet in your browser.

Creating Help for a form, a dialog or control with local CHM file

Properties to display help (CHM file - local)

Activate the hlpProvider component and set the HelpNameSpace property of hlpProvider1 to the file name you want to work with. Here we use a CHM file. CHM files are a compressed ITStorage format that is used by Microsoft's HTMLHelp Workshop.


  Private Sub cmdControl2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  Handles cmdControl2.Click
    Dim sHelpFile As String
    Dim sStartupPath As String
    '--- Initialize context-sensitive help ---
    sStartupPath = Application.StartupPath.ToString
    sHelpFile = Replace(sStartupPath, "\bin", "\hlp") & "\VBnetCHM.chm"
    Me.hlpProvider1.HelpNamespace = sHelpFile
    Me.hlpProvider1.SetHelpNavigator(Me.cmdControl1, HelpNavigator.KeywordIndex)
    Me.hlpProvider1.SetHelpKeyword(Me.cmdControl1, "Help topic of control 1")
  End Sub

Show Table of Contents (TOC) tab and search related topic by keyword

Set the HelpNavigator property of a control (e.g. a button) to a value of the HelpNavigator enumaration (http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#enumeration).

To get following results from the example, press F1 key when the button has focus or click the HelpButton and then click the corresponding button:


Note: The call is dependent on the last open tab (Contents or Index) before closing the CHM window.



Show Index and places on the first available keyword that starts with the letter.

Set the HelpNavigator property of a control (e.g. a button) to a value of the HelpNavigator enumaration (http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#enumeration).

To get following results from the example, press F1 key when the button has focus or click the HelpButton and then click the corresponding button:


Please notice further http://www.help-info.de/en/Visual_Basic_net/vbnet_faq.htm.


Show Index tab and highlight keyword in keyword list

Set the HelpNavigator property of a control (e.g. a button) to a value of the HelpNavigator enumaration (http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#enumeration).

To get following results from the example, press F1 key when the button has focus or click the HelpButton and then click the corresponding button:


Note: Click "Show" ("Anzeigen") to view the topic in the contents pane.


Show Search tab

Set the HelpNavigator property of a control (e.g. a button) to a value of the HelpNavigator enumaration (http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#enumeration).

To get following results from the example, press F1 key when the button has focus or click the HelpButton and then click the corresponding button:


Show Table of Contents (TOC) tab

Set the HelpNavigator property of a control (e.g. a button) to a value of the HelpNavigator enumaration (http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#).

To get following results from the example, press F1 key when the button has focus or click the HelpButton and then click the corresponding button.


Show Topic

Set the HelpNavigator property of a control (e.g. a button) to a value of the HelpNavigator enumaration (http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#).


To get following results from the example, press F1 key when the button has focus or click the HelpButton and then click the corresponding button.


HelpNavigator Enumeration

The HelpNavigator property is an enumeration that specifies the Help command to use when retrieving Help from the Help file for the specified control.

HelpNavigator Property
Description
http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#associateindex Shows the index and places on the first available keyword that starts with the letter. The letter is deduced from the first letter of the word in the HelpKeyword property.
http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#find Show Search tab.
Something (?) is necessary in the HelpKeyword property!
http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#index Show the index and place on the keyword. The keyword is indicated in the HelpKeyword property.
http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#keywordindex Show Table of Contents (TOC) , places on the topic and shows the related topic in the contents pane. The topic is searched with the keyword which is indicated in the HelpKeyword property.
http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#toc Specifies that the table of contents (TOC) of the HTML 1.0 Help file is displayed.
HelpKeyword property detail not necessary!
http://www.help-info.de/en/Visual_Basic_net/vbnet_htmlhelp.htm#topic Specifies that the topic referenced by the specified URL is displayed.
TopicId This value becomes availably only with .NET 2.0.

Download Example

Unfortunately, you don't have Visual Studio .NET but you have installed the Microsoft .NET Framework 1.0 (e.g. from your CD-Version of Windows XP SP1) unzip the example for Visual Basic 2002 and double-click the file VBnetCHM.exe.

context-sensitive help in Winforms - mv ark replied to Eswaran Radhakrishnan on 17-Nov-08 04:05 AM
This MS KB step-by-step article describes how to provide online help pages and context-sensitive help for the controls in a Microsoft Windows application - http://support.microsoft.com/default.aspx?scid=kb;en-us;821777
The following native classes are used - System.Windows.Forms.Help & System.Windows.Forms.HelpProvider

You can also use commercial tools -
HelpScribble - http://www.helpscribble.com/dotnet.html
West Wind HTML Help Builder - http://www.west-wind.com/wwHelp/docs/