private void btnAdd_Click(object sender, EventArgs e) { string category = txbCategory.Text; string desc = txbItem.Text; DateTime dates = DateTime.Now; ToDo.Levels level; switch (cmbLevel.SelectedItem.ToString()) { case "Not Important": level = ToDo.Levels.NotImportant; break; case "Important": level = ToDo.Levels.Important; break; default: level = ToDo.Levels.Urgent; break; } ToDo toDo = new ToDo(category, desc, dates, level); ListUtil.toDoList.Add(toDo); TextFileUtil.writeToFile(ListUtil.toDoList); loadListBox(); }
private void frmToDo_Load(object sender, EventArgs e) { ListUtil.toDoList = TextFileUtil.readFromFile(); loadListBox(); }