944,051 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 10621
  • C# RSS
Jun 8th, 2006
0

Embedding a spreadsheet and chart into a windows form

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
C#4fun is offline Offline
2 posts
since Jun 2006
Jun 9th, 2006
0

Re: Embedding a spreadsheet and chart into a windows form

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:

[uml]http://www.developersdex.com/asp/message.asp?p=2912&ID=%3C49D1FB22-A2E0-45A2-A38F-D5FE16322965%40microsoft.com%3E[/uml]

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
C#4fun is offline Offline
2 posts
since Jun 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: C#,system tray, wont go from task bar.
Next Thread in C# Forum Timeline: Blon insert in MySQL using ODBC in C# win Application





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC