Posts

Showing posts from January, 2021

Getting the WinForms HelpProvider namespace for a control programatically using C#

We recently had an issue whereby we wanted to have a Windows Form control in a control library which could be presented with a HelpNamespace and HelpKeyword that could be customised based on the end product that the UI was integrated with. The control itself automatically inherits the help of the parent, but when the control opens a child form that Windows Form doesn't know of the help information. However, manually assigning the HelpNamespace to the UI control which it then passes to the form seemed tedious given that the form on which the control resides already knows the namespace, but how to get that namespace programatically. The HelpProvider is a component, not a control so you need to use the following code. If the control doesn't have a HelpProvider assigned directly, the controls' parent is queried. /// <summary> /// Returns the help namespace assigned to the specified control, or its parent form. /// </summary> /// <param name=" control &qu