PRB: Incorrect Code is Generated for the HelpProvider Component (325159)
The information in this article applies to:
- Microsoft Visual C# .NET (2002)
This article was previously published under Q325159 SYMPTOMS
If you set the Localizable property of a C# Windows form to True, incorrect code is generated for the HelpProvider component.
With the C# compiler, you receive the following errors:
error CS1502: The best overloaded method match for 'System.Windows.Forms.HelpProvider.SetHelpKeyword(System.Windows.Forms.Control, string)' has some invalid arguments
error CS1503: Argument '2': cannot convert from 'object' to 'string'
CAUSE
The code that is generated by the Windows Forms Designer is incorrect.
Both the HelpProvider.SetHelpKeyword and the HelpProvider.SetHelpString methods expect a string as their second argument, however, the code that is generated passes an object as the second argument instead.
RESOLUTION
To resolve this issue, use either of the following methods:
- Cast the second argument into a String.
- Use the ToString() method of the object.
NOTE: After you use either of these methods, you have to specify a valid second argument to the method call. For example, the SetHelpKeyword method of the HelpProvider class expects a Help keyword to be associated with a control.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 7/26/2002 |
---|
Keywords: | kbprb KB325159 |
---|
|