Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace ToDo_List
- {
- public partial class Form1 : Form
- {
- LinkedList<String> todoList = new LinkedList<String>();
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void displayList()
- {
- ItemTextBox.Text = "";
- ToDoListBox.Items.Clear();
- foreach (string item in todoList)
- {
- ToDoListBox.Items.Add(item);
- }
- }
- private void AddFrontButton_Click(object sender, EventArgs e)
- {
- String newItem = ItemTextBox.Text;
- if (newItem.Length > 0)
- {
- todoList.AddFirst(newItem);
- displayList();
- }
- }
- private void AddBackButton_Click(object sender, EventArgs e)
- {
- String newItem = ItemTextBox.Text;
- if (newItem.Length > 0)
- {
- todoList.AddLast(newItem);
- displayList();
- }
- }
- private void ClearButton_Click(object sender, EventArgs e)
- {
- todoList.Clear();
- displayList();
- }
- private void RemoveButton_Click(object sender, EventArgs e)
- {
- string removeItem = ToDoListBox.Text;
- todoList.Remove(removeItem);
- displayList();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement