public void editTask_Click(object sender, EventArgs e) { try { edittedTask = currentTasks[taskList.SelectedIndex]; int editIndex = taskList.SelectedIndex; newTask = new NewTask(this); newTask.TaskName.Text = edittedTask.Name; newTask.taskTime.Value = Convert.ToDateTime(edittedTask.Date); newTask.HourBox.Text = Convert.ToString(edittedTask.Date.Hour); newTask.MinuteBox.Text = Convert.ToString(edittedTask.Date.Minute); newTask.Location.Text = edittedTask.Location; newTask.Details.Text = edittedTask.Details; newTask.Alarm.Text = edittedTask.Alarm.ToString(); newTask.editing = true; this.Hide(); newTask.Show(); allTasks.Remove(edittedTask); currentTasks.Remove(edittedTask); taskList.Items.RemoveAt(editIndex); } catch { } }
private void createTask_Click(object sender, EventArgs e) { newTask = new NewTask(this); this.Hide(); newTask.Show(); }