开发者

Get the Databound Member from GUI Populated MS Chart Series

I have a set of charts in a form. These are "canned" charts and will only be updated when new data comes in (typically on a monthly basis). I have created each chart by binding (bounding?) a data source to it开发者_StackOverflow in VS2010 using the Properties slide out window. I set the DataSource to a data source table that I set up in the .XSD file. In the Series property GUI I have set up the XValueMember and YValueMembers from the available columns in the data table I set in the previous step. I have 6 tables in my DataSet. One table relates to one Chart (Chart1, Chart2, Chart3, etc) in my form.

What I would like to do is programmatically get the data table name from the Chart properties. I have tried doing something like:

ch1Table = Chart1.DataSource.DataMember.ToString

However this fails due to Option Strict disallowing late binding. I am probably missing something obvious here but I cannot see it.

So, how do I get the bound data table name from the set properties of the chart? I am using MSChart Control 4 and VS2010 and building a VB.NET WinForms app.

EDIT to expand on question: For each of the 6 charts there is an associated System.Windows.Forms.BindingSource. What I need to do is programmatically get that BindingSource, then get the DataMember (which is the table name I need) for each chart.


Fellow worker hammered away at it and came up with:

CType(Chart1.DataSource, BindingSource).DataMember

This provides me with the table name as desired.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜