.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
satyapriyanayak
SP
Sambanthamoorthy
Ashutosh Jha
Imran Ghani

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Open Help file on F1 function key press in windows application

Posted By:Pankaj Mishra       Posted Date: December 18, 2008    Points: 25    Category: .Net Framework    URL: http://www.dotnetspark.com  
 

This article explains how to open help file on F1 Function key press in windows application.

Almost all applications need Help file. It could be .chm , .PPT, . HTML, .PDF or any other kind of file which you want to open on F1 key press. Lets see how can we do that.

.NET Framework provides F1helpProvider component to handle F1 key press. You can use this component to show help file (.chm, .PPT, .PDF etc.,) to the user.  The developer need not have to write even a single line of C# or Vb.Net code to display help file on press of F1 function key from keyboard.

You can find the helpProvider component under Component tab of ToolBox in Visual Studio. Below is the pic which will guide you to find Helpprovider component.


 

Now Just drag helpProvider into your application. Then  go to the property of HelpProvider and  Set its "HelpNamespace" property to your desired help file path. Below is the picture which will guide you to do that.

 


Once you set the property, then compile and run your sample application.

Now click F1 Button from your keyboard when the focus is on your application and you will see your help file opened.

You can also set the different property of helpProvider componet (Which you have added in the main form) from the  MainForm property window, for eg.,  set the TOC when user clicks on the F1 key. You can also set the property to show window help button etc.,

Now we will see how to display help topic in a .chm file by keyword on a Button Click

Step 1 -> Click Button1 and display its properties.
Step 2 ->Set the HelpKeywordonHelpProvider1 property to "Your .CHM Topic".
Step 3 -> Set the HelpNavigatoronHelpProvider1 property to "KeywordIndex".
Step 4 -> Compile and run your application

If you want to set using Code you can do like this

helpProvider1.HelpNamespace = "C:/helpFile.chm";

helpProvider1.SetHelpNavigator(Button1, HelpNavigator.KeywordIndex); //Set the Keyword

helpProvider1.SetHelpKeyword(Button1, "Your .CHM Topic"); // Topic in help file.


Hope this will help all who wants to integrate F1 key press  to open help file in windows application.

Cheers
Pankaj

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend