Using Visual Studio 2003

Hi, I am trying to incorporate a spreedsheet and chart into my windows forms application. My current attempt is using the web controls, AxOWC10.AxSpreadsheet and AxOWC10.AxChartSpace with the Primary Interop Asseblies installed. If I understand, these controls are intended for use in web pages; perhaps it is bad practice to use them in a Form. If that is the case please steer me in the right direction, if using the web controls in a Form is acceptable then I might be going down the right path and am just hung up.

A little about the overall project:
I am recieving data continuously from four serial ports (that's working) and loading it to the AxSpreadsheet in my Form (that's working too!) The data is comming from three load cell indicators, and one digital string pot device at a rate of 10 samples/sec each and they are completely asychronous. I would like the chart to be updated "real time" and like to have the data stored in a spread sheet for easy portability as well as binding to chart.

What I need help with.
The problem is in getting the chart bound to the spreadsheet data. I cannot figgure out or find help in searches on how to feed series data into a chart directly from code, or link it to a spreadsheet so the chart will update automaticly when the spreadsheet is updated. The help I have found says that the AxChartSpace is capable of automaticly updating when its data source is updated, and also that it can be bound to a spreadsheet.

P.S., not a student any more. If it was for a grade I would just make the chart brute force and not worry much about maintainability or sleek appearance, but I hope to use this app for a long time.

Thank you for your time.

In my contiuing research I have found that using web components in a form is OK, that is according to Alvin Bruney in his post:


I have also learned to use the chart's setData method, but keep getting runtime errors on it. I believe that it is becuase of the way I am trying to connect it to the spread sheet. This is becuase when I debug I see that the data source for the chart is null. Examples in VB show:

Set ChartSpace1.DataSource = Spreadsheet1

I've tired all I can think of in C#, the most commonly seen is:

axChartSpace1.DataSource = (msdatasrc.DataSource)(object)axSpreadsheet1;

but that throws the "Specified cast is not valid." runtime exception.

I am using the OWC10 not Owc11 I have nothing against using Owc11 other than I cannot figgure out how to referance it correctly. I can referance the OWC10 stuff as I can manipulate the OWC10.axSpreadsheet and .axChartSpace, just cannot bind the chart to the spreadsheet.

Thanks again and I guess I will keep updating this thread as I learn more. Hopefully I won't be the only one contributing! Have a great weekend.

This article has been dead for over six months. Start a new discussion instead.