tags:

views:

155

answers:

1

Hi,

I have this code in a form constructor

help = new HelpProvider();
this.help.HelpNamespace = @"C:\temp\help.chm";
this.help.SetHelpNavigator(this.button1, HelpNavigator.KeywordIndex);
this.help.SetHelpKeyword(this.button1, "key1lic");

this.help.SetHelpNavigator(this.button2, HelpNavigator.KeywordIndex);
this.help.SetHelpKeyword(this.button2, "test index");

When I have the focus on button1 and press F1 help.chm opens at "key1lic" index (there is a page for this index). But when I set the focus on button2 and press F1 the help file opens at the same index, that is, "key1lic", instead of "test index".

Same happens when I try to use the HelpProvider control and I manually set the index for each button.

Can someone explain me what I'm doing wrong ?

Thank you, Mosu'

Edit: Ok, this is very hilarious! This is focus problem and not a HelpProvider problem. I was never setting the focus on the other button. I was just putting the mouse on it but this does not change the focus :-))

A: 

You have to reset the Keyword with this.Help.SetHelpKeyword(button1,null);

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

Look under Remarks

Lude
See the edit at my question.Thank you for your answer.
mosu