PRB: "InvalidCastException" Error Message When You Bind an Office 2003 Web Component on a .NET Windows Form (829115)
The information in this article applies to:
- Microsoft Office 2003 Web Components
- Microsoft Visual C# .NET (2002)
- Microsoft Visual C# .NET (2003)
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual Basic .NET (2003)
- Microsoft .NET Framework 1.0
- Microsoft .NET Framework 1.1
For a Microsoft Office XP Web Components version of
this article, see
319398. SYMPTOMS When you bind a Microsoft Office 2003 Web Component to
another Office 2003 Web Component for a DataSource property at run time, you receive the following error
message: An unhandled exception of type
'System.InvalidCastException' occurred in
<YourWindowsApplication.exe> Additional information: Specified cast
is not valid. You receive this error message when you bind a
Microsoft Office Spreadsheet Component, a Microsoft Office PivotTable Component, or a Microsoft
Office Chart Component to one of the other Office Web Components. For example,
the following line of code generates the error: AxChartspace1.DataSource = AxSpreadsheet1 RESOLUTION
To resolve this problem, set the DataSource property for the component to the object that the GetOcx method of the control returns. The GetOcx method is intended to act as the DataSource. The following is an example: AxChartspace1.DataSource = AxSpreadsheet1.GetOcx() REFERENCES For additional information about Microsoft Office Web
Components object model, see the Microsoft Office Web Components Visual Basic
Reference (Owcvba11.chm). The default installation path for this reference
is: C:\Program Files\Common Files\Microsoft Shared\Web
Components\11\1033
Modification Type: | Major | Last Reviewed: | 10/28/2003 |
---|
Keywords: | kbOfficeWebChart kbOfficeWebPivot kbOfficeWebSpread kbprb KB829115 kbAudDeveloper |
---|
|