/// <summary> /// Handles the Click event of the button3 control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void button3_Click(object sender, EventArgs e) { int value; if (int.TryParse(textBox2.Text, out value)) { bt.Insert(value); TextBoxDisplay.Text = bt.ToString(); MessageBox.Show(String.Format("The value {0} was successfully inserted!", value)); } else { MessageBox.Show("Enter a valid, positive integer"); } }
/// <summary> /// Populates the b tree. /// </summary> /// <param name="size">The size.</param> private void PopulateBTree(int size) { bt = new BTree(size); r = new Random(); while (bt.ValueCount < 500) { bt.Insert(r.Next(0, 10000)); } TextBoxDisplay.Text = bt.ToString(); }