PRB: InvalidCastException When You Bind Office XP Web Component on a .NET Windows Form (319398)
The information in this article applies to:
- Microsoft Office XP Web Components
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual C# .NET (2002)
This article was previously published under Q319398 SYMPTOMS
When you bind an Office XP Web Component to another Office XP Web Component for a DataSource 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 might receive this error when you bind a Spreadsheet Component, a PivotTable Component, or a 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, which is intended to act as the DataSource. The following is an example:
AxChartspace1.DataSource = AxSpreadsheet1.GetOcx()
REFERENCES
For additional information about the Office XP Web Components object model, see the Microsoft Office Web Components Visual Basic Reference (Owcvba10.chm). The default installation path for this reference is
C:\Program Files\Common Files\Microsoft Shared\Web Components\10\1033\.
Modification Type: | Major | Last Reviewed: | 9/25/2002 |
---|
Keywords: | kbOfficeWebChart kbOfficeWebPivot kbOfficeWebSpread kbprb KB319398 |
---|
|