"Can you give me a "butt-simple" example of reading two points in from an excel spreadsheet and displaying them on a chart in Visual basic 2010? All the examples I see get bogged down in the dumb chart appearance stuff and you can't see how you just put a couple simple points on a line or bar chart!"
Sure thing Tom! "Simple" is my middle name! (And part of my last name is "butt" too!)
There are still a few points about your "user requirements statement" that are unclear. First, it's not clear whether you want the chart to be displayed in VB.NET or in the Excel spreadsheet. You can do it either way but I'm going to assume that you want the chart displayed in a VB.NET form. Second, it's not clear where your data is coming from. Do you need to add data to the spreadsheet and then chart it? Or is the data already in the spreadsheet? Since your question seems to be mainly about charting, I'll assume that the data is already in an existing spreadsheet ... all two points of it.
So ... Here's a spreadsheet (Excel 2010) containing two points and a chart. (click on the image)
Step 1 is to create a Windows form based project containing a Button and a PictureBox. Add a reference to "Microsoft Excel 14.0 Object Library". (Under the Com tab in the project properties, References tab. See more about this here and here.) In the Click event for the Button ...
- Open an instance of Excel
- Open the spreadsheet
- Drill down to the chart
- Export the chart to a file
- Assign the file to the PictureBox
- Close Excel again
If you assign StretchImage to the Size property of the PictureBox, it looks pretty good! The steps above don't tell you exactly how to write the code, however. Download the project using the link below to see the whole thing.