BUG: You receive a "System.Runtime.InteropServices.COMException" message when you bind an ImageList ActiveX control to a CoolBar ActiveX control (820627)



The information in this article applies to:

  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

SYMPTOMS

In Microsoft Visual Studio 2005 or in Microsoft Visual Studio .NET, when you set the ImageList property of the CoolBar ActiveX control to the ImageList ActiveX control, and then you run the application, you receive the following exception:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in axinterop.comctl3.dll
Additional information: Invalid property value.
Note You cannot set the ImageList property of the CoolBar ActiveX control in the Properties window.

CAUSE

Microsoft Visual Basic 2005, Microsoft Visual Basic .NET, and Microsoft Visual C# .NET interpret the ImageList property of the CoolBar ActiveX control as a read-only property. Therefore, Visual Basic 2005, Visual Basic .NET, and Visual C# .NET throw an exception when you set the ImageList property of the CoolBar ActiveX control to the ImageList ActiveX control.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

  1. Start Microsoft Visual Studio 2005 or Microsoft Visual Studio .NET.
  2. Start a new Microsoft Windows application by using Visual Basic 2005, Visual Basic .NET, or Visual C# .NET.

    By default, a form that is named Form1 is created.
  3. On the Tools menu, click Add/Remove Toolbox Items.

    Note If you are using Visual Studio 2005, click Choose ToolBox Items on the Tools menu.

    Note If you are using Microsoft Visual Studio .NET 2002, click Customize Toolbox on the Tools menu.
  4. On the COM Components tab, click Microsoft CoolBar Control, version 6.0 and Microsoft ImageList Control 6.0 (SP4), and then click OK.
  5. From the toolbox, drag Microsoft CoolBar Control, version 6.0 and Microsoft ImageList Control 6.0 (SP4) to Form1.

    Note If you are using Visual Studio .NET (2002), drag Microsoft CoolBar Control, version 6.0 and Microsoft ImageList Control 6.0 (SP4) from the toolbox to Form1.
  6. From the toolbox, drag a Button control to Form1.
  7. Add the following code to the Click event of Button1.

    Visual Basic 2005 or Visual Basic .NET code
    'Set the ImageList property of the CoolBar control to the ImageList control.
    AxCoolBar1.ImageList = AxImageList1
    Visual C# .NET code
    //Set the ImageList property of the CoolBar ActiveX control.
    axCoolBar1.ImageList =axImageList1;
  8. On the Debug menu, click Start.
  9. On Form1, click Button1.

    You receive the exception mentioned in the "Symptoms" section of this article.

REFERENCES

For more information about the CoolBar ActiveX control, visit the following Microsoft Developer Network (MSDN) Web site:

Modification Type:MinorLast Reviewed:10/3/2006
Keywords:kbvs2005swept kbvs2005applies kbvs2002sp1sweep kbinterop kberrmsg kbComCtrls kbProperties kbImgList kbCtrl kbControl kbbug KB820627 kbAudDeveloper