private void button1_Click(object sender, EventArgs e) { list = new MyList(); for (int i = 0; i < ctrlDgv.RowCount - 1; i++) list.Add(Convert.ToString(ctrlDgv.Rows[i].Cells[0].Value)); list = list.SortDel(); string[] arr = list.Printer(); ctrlDgvout.RowCount = arr.Length; for (int i = 0; i < arr.Length; i++) ctrlDgvout.Rows[i].Cells[0].Value = arr[i]; }
// DeleteBt public MyList SortDel() { MyList list2 = new MyList(); MyNode p = head; if (p != null) { list2.Add(p.inf); do { if (p.next != null) { if (list2.head.inf != p.next.inf) list2.Add(p.next.inf); p = p.next; } } while (p.next != null); } return list2; }