Dragpoint tool and binding to a datatable

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Mike Jones
Advanced
Posts: 192
Joined: Thu Feb 01, 2007 12:00 am
Contact:

Dragpoint tool and binding to a datatable

Post by Mike Jones » Mon Jun 02, 2008 3:38 pm

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.

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Re: Dragpoint tool and binding to a datatable

Post by Christopher » Tue Jun 03, 2008 10:38 am

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());
		}
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply