I am new to C# windows application.I would like to add custom help file using help provider from the toolbar in Microsoft visual studio 2010 for windows applica
Short story - no, you can achieve this (F1-Help) without writing code (but sometimes coding is a better solution).
The HelpNavigator property is an enumeration that specifies the Help command to use when retrieving Help from the Help file for the specified control (see also: Help for controls with VB .NET).
Connecting a CHM help file with your application and providing context-sensitive help for controls has a small learn curve.
Below are (code) examples that demonstrate using context-sensitive help by F1 and how to open the help viewer by TopicId.
F1 - Help
.HelpKeyword
, .HelpNavigator
, .HelpString
, .ShowHelp
.
Set the full path to your CHM file to the
HelpProvider.HelpNamespace
property.?
button on the form's caption area, set the
values of the following form properties HelpButton = True
,
MaximizeBox = False
, MinimizeBox = False
.?
button was clicked by the user. For example, set the button1
HelpKeyword
property to 20010 and its HelpNavigator
property to
.TopicId
as shown in the screenshot below.... and the resulting help viewer window:
Open the Help Viewer
Following code is used to open a Help Viewer and a topic by TopicId 10000:
private void btnTopicId_Click(object sender, EventArgs e)
{
Help.ShowHelp(this.btnOpenHelpShowTopic, helpProvider1.HelpNamespace, HelpNavigator.TopicId, @"10000");
}