private void BtnTskIr_Click(object sender, EventArgs e) { int tk = ChLsBxTaskList.SelectedIndex; if (tk == -1) { MessageBox.Show("No task selected. Please select a task and try again."); ChLsBxTaskList.Focus(); } else { String FileName = Directory.GetCurrentDirectory() + Uname + "-Tasks-" + dt + ".txt"; ChLsBxTaskList.Items.RemoveAt(tk); String[] list = System.IO.File.ReadAllLines(FileName); System.IO.StreamWriter sw = new System.IO.StreamWriter(FileName); for (int i = 0; i < list.Length; i++) { if (i == tk) { } else { sw.WriteLine(list[i].ToString()); } } sw.Close(); } }
private void BtnRemind_Click(object sender, EventArgs e) { Reminder r = new Reminder(); r.st = 2; r.FName = Fname; List <string> lst = new List <string>(); if (ChLsBxTaskList.SelectedIndices == null) { MessageBox.Show("No tasks selected to set reminder. Please select one or more tasks"); ChLsBxTaskList.Focus(); } else { int i; for (i = 0; i < ChLsBxTaskList.SelectedItems.Count; i++) { lst.Add(ChLsBxTaskList.SelectedItems.IndexOf(i).ToString()); } } r.TLst = lst; r.Show(); }