BUG: You receive a "Method not found" error message when you add a UserControl to a form if the UserControl code invokes AXControl methods (316741)
The information in this article applies to:
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual C# .NET (2002)
This article was previously published under Q316741 SYMPTOMS Under the following circumstances:
- You build a .NET UserControl.
- You add a Component Object Model (COM) ActiveX control (AXControl) to the .NET UserControl.
- Code in the UserControl calls methods from the AXControl.
- You attempt to add the UserControl to a form in a Windows project.
you receive the following error message:
An exception occurred while trying to create an instance of
project name.usercontrol
name. The exception was "Method not found: MSComctlLib.ListImages
AxMSComctlLib.AxImageList.get_ListImages()." NOTE: The text of the error message may differ, depending on the
control that you use. This particular error message occurred after using the ImageList control. If you receive an exception under similar circumstances
when you use a different AXControl, the library or the method that is listed differs. RESOLUTION To work around this problem, you can use either of the
following methods: Workaround One If there is an exact or a similar .NET UserControl version of the control, use the .NET control.
Workaround Two Add a reference to the AXControl in the client application before you add the UserControl to a form. You do not have to use the AXControl in the client application. You can use the reference
only.
To obtain a reference to the AXControl, add the AXControl to the form in the client project. After the control is added to
the form, and after the reference is added to the project assembly, remove the AXControl from the form.
You can add an ImageList control to Form1 in the Windows application before you add the UserControl. No exception occurs. You can remove the ImageList control from Form1 either before or after you add the UserControl to the form. However, leave the assembly references to the
control as is. You can see the assembly references in Solution Explorer. View
the assembly references that are listed in the References node that follows your project name. STATUS This bug was corrected in Visual Basic .NET (2002) and
Visual C# .NET (2002).
Modification Type: | Minor | Last Reviewed: | 2/3/2006 |
---|
Keywords: | kbvs2005doesnotapply kbvs2005swept kbvs2002sp1sweep kbbug kbpending KB316741 kbAudDeveloper |
---|
|