Page 1 of 1

chartlistbox1_RemovedSeries

Posted: Sat Feb 23, 2008 4:16 pm
by 13045490
I am allowing a user to delete a series from the chartlistbox control but I would like to know which series is being deleted (series index or the selected index that the delete key was pressed on). I was thinking that the RemovedSeries event would tell me which series was being removed. However, when I look in the event handler I could not determine this. The selected index is -1.

How can I tell which series index is being deleted?

It looks like removedseries is called before the actual remove becuase the list still has the series in it. Is this true?

Posted: Mon Feb 25, 2008 10:46 am
by narcis
Hi johnf,

You can do something like in the code below which works fine for me hre.

Code: Select all

		public Form1()
		{
			InitializeComponent();

			for (int i = 0; i < 3; i++)
			{
				Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
				line1.FillSampleValues();
			}

			chartListBox1.KeyDown += new KeyEventHandler(chartListBox1_KeyDown);
		}

		void chartListBox1_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Delete)
			{
				tChart1.Header.Text = chartListBox1.SelectedIndex.ToString();
			}
		}