I am trying to get one point of a Chart in C# Visual Studio 2010 using the following code:

chart1.Series[0].Points.Item[1]

but I get the following error:

Error 1 'System.Windows.Forms.DataVisualization.Charting.DataPointCollection' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'System.Windows.Forms.DataVisualization.Charting.DataPointCollection' could be found (are you missing a using directive or an assembly reference?)

But supposedly Points being a DataPointCollection should have the property Item as is shown on Microsoft's webpage:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.datapointcollection.aspx

What am I doing wrong?

有帮助吗?

解决方案

Surely, since Points is the collection, you should be doing:

chart1.Series[0].Points[1].Item
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top