Advertisement
SuperLemrick

To-Do List Program

Dec 9th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace ToDo_List
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         LinkedList<String> todoList = new LinkedList<String>();
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void Form1_Load(object sender, EventArgs e)
  21.         {
  22.            
  23.         }
  24.         private void displayList()
  25.         {
  26.             ItemTextBox.Text = "";
  27.             ToDoListBox.Items.Clear();
  28.  
  29.             foreach (string item in todoList)
  30.             {
  31.                 ToDoListBox.Items.Add(item);
  32.             }
  33.         }
  34.  
  35.         private void AddFrontButton_Click(object sender, EventArgs e)
  36.             {
  37.                 String newItem = ItemTextBox.Text;
  38.  
  39.                 if (newItem.Length > 0)
  40.                     {
  41.                         todoList.AddFirst(newItem);
  42.  
  43.                         displayList();
  44.                     }
  45.           }
  46.  
  47.         private void AddBackButton_Click(object sender, EventArgs e)
  48.         {
  49.             String newItem = ItemTextBox.Text;
  50.             if (newItem.Length > 0)
  51.             {
  52.                 todoList.AddLast(newItem);
  53.  
  54.                 displayList();
  55.             }
  56.         }
  57.  
  58.         private void ClearButton_Click(object sender, EventArgs e)
  59.         {
  60.             todoList.Clear();
  61.             displayList();
  62.         }
  63.  
  64.         private void RemoveButton_Click(object sender, EventArgs e)
  65.         {
  66.             string removeItem = ToDoListBox.Text;
  67.             todoList.Remove(removeItem);
  68.  
  69.             displayList();
  70.         }
  71.      }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement