How can I find the name or index from the CheckedListBox list when I click on one of the list items?
And is it possible to find out information about the element on which I click not only in CheckListBox , but also let's say Label ? I want to make a button that removes this selected item from my list.
private void button3_Click(object sender, EventArgs e) { bool relay = false; int nolIndex = 0; int k3 = 0; GraphPane pane = zedGraph.GraphPane; for (int i = 0; i < Program.axisList[0].sumAxis; i++) { if (Program.axisList[i].sumPoints == 0) nolIndex = i; } if (nolIndex != 0) relay = true; for (int i = 0; i < checkedListBox1.Items.Count; i++) { if ((checkedListBox1.CheckOnClick == true)||(checkedListBox1.CheckOnClick == false))&&(номер по которому кликнул) { if (i < nolIndex) { k3 = 0; checkedListBox1.Items.RemoveAt(i+k3); pane.CurveList[i + k3].IsVisible = false; pane.YAxisList[i + k3].IsVisible = false; labelOfAxis[i + k3].Visible = false; pane.XAxis.IsVisible = false; } else if ((i == nolIndex) && (i != 0)) { checkedListBox1.Items.RemoveAt(i + k3); pane.CurveList[i + 1].IsVisible = false; pane.YAxisList[i + 1].IsVisible = false; labelOfAxis[i + 1].Visible = false; pane.XAxis.IsVisible = false; } else { if (relay == true) k3 = 1; else k3 = 0; checkedListBox1.Items.RemoveAt(i + k3); pane.CurveList[i + k3].IsVisible = false; pane.YAxisList[i + k3].IsVisible = false; labelOfAxis[i + k3].Visible = false; pane.XAxis.IsVisible = false; } } } k3 = 0; } 