private void button2_Click(object sender, EventArgs e) { for (int i = 0; i < checkedListBox2.Items.Count; i++) { checkedListBox2.Items.RemoveAt(i); i--; } Trains.GetTrains().Clear(); }
private void button2_Click(object sender, EventArgs e) { List <Train> addList = new List <Train>(); foreach (var index in checkedListBox1.CheckedIndices) { addList.Add(list[(int)index]); } Trains.AddTrains(addList); TranTime.Clear(); TranTime.AddTime(dateTimePicker1.Value.ToString("yyyy-MM-dd")); }