Help with Office Chart and Spreadsheet

rahavtom

Well-known member
Joined
Apr 2, 2004
Messages
63
Dear All!

I use Visual Basic .NET 2003 and want to produce graphs by using Office Chart 11.0.
I would like to provide this chart with data from an Office Spreadsheet 11.0 and I use the following code I have found:

...
ChartSpace1.Clear()
ChartSpace1.Charts.Add()
Dim c = ChartSpace1.Constants

ChartSpace1.DataSource = Spreadsheet1 // Heres the problem

ChartSpace1.Charts(0).SeriesCollection.Add()
....

When I run this code, I get an error message saying that the specified cast is invalid, reffering to the line I marked (Datasource).

Does anyone know what what can be done to fix it?
Thanks!
Tom.
 
What is type for DataSource and what is the type of Spreadsheet1? You need to make sure that they are compatible.
 
Back
Top