// Insert a cell after the indicated one. public void InsertAfter(string afterName, string newName) { // Find the target cell. PeopleCell afterCell = FindCell(afterName); if (afterCell == null) { throw new KeyNotFoundException("Item " + afterName + " not found in list."); } // Insert the new name after the one we found. afterCell.InsertAfter(newName); }
private void Form1_Load(object sender, EventArgs e) { // Make some test people. TopCell.InsertAfter("Arthur"); TopCell.InsertAfter("Betty"); TopCell.InsertAfter("Charles"); TopCell.InsertAfter("Deena"); // Display the list. DisplayList(); }