Page 1 of 1

Dragpoint tool and binding to a datatable

Posted: Mon Jun 02, 2008 3:38 pm
by 8739068
I would like to use the dragpoint tool to edit values in a datatable.

I have databound my point series to a datatable and use the dragpoint tool to change the values of the points. How do I get the changes of the points coordinates to write the data back to the datatable?

I have tried using the dragPoint_Drag event to detect a point value has changed. Within the event handler I have tried using the series.WriteToDataSource() method, but that does not seem to work.

Any suggestions?

I would like to bind to a DataView. Should I be able to bind to the DataView pretty much the same way as a datatable? I need to modify the values in the table using the dragpoint tool.

Re: Dragpoint tool and binding to a datatable

Posted: Tue Jun 03, 2008 10:38 am
by Chris
Hello Mike,
Mike wrote: Any suggestions?
Something like the following seems to work as expected:

Code: Select all

		private Points series1;
		private DragPoint tool1;
		private DataSet data;

		private void InitializeChart()
		{
			tChart1.Series.Add(series1 = new Points());
			series1.FillSampleValues(3);

			tChart1.Tools.Add(tool1 = new DragPoint());

			data = series1.DataSource as DataSet;
		}



		private void button1_Click(object sender, EventArgs e)
		{
			series1.WriteToDataSource();
			data = series1.DataSource as DataSet;
			DataTable table = data.Tables[0];

			MessageBox.Show(table.Rows[0][1].ToString());
		}