// AddTask button method, takes the inputed information and builds the ToDo object and adds it to the list. private void btnAddTask_Click(object sender, EventArgs e) { string newItem = txtToDo.Text.Trim(); string category = cbxCategory.SelectedItem.ToString(); bool urgent = chkUrgent.Checked; // Here we build the Task, using the variables to build. Task newTask = new Task(newItem, category, urgent); // If the details are empty, we need to stop. if (!string.IsNullOrEmpty(newTask.details)) { // Here we using the GetTask method to build a string to add to the list. string addingTask = newTask.GetTask(); if (itemsIsInList(clsToDo.Items, addingTask)) { MessageBox.Show("You already added that item.", "Error"); } else { clsToDo.Items.Add(addingTask); txtToDo.Text = ""; } } }