private void button1_Click(object sender, EventArgs e) { try { int t = Convert.ToInt32(textBox2.Text); if (t <= 1) { throw new FormatException(); } B_Tree <ComparableInt> newTree = new B_Tree <ComparableInt>(t, ComparableInt.FromStr); var list = b_Tree.ToList(); foreach (var i in list) { newTree.Insert(i); } b_Tree = newTree; treeControl.updateTree(b_Tree); }catch (FormatException ex) { MessageBox.Show("Уровень ветвистости задается целым числом > 1"); } }
private void addButton_Click(object sender, EventArgs e) { b_Tree.Insert(new ComparableInt(Convert.ToInt32(textBox1.Text))); treeControl.updateTree(b_Tree); }