private void MultiplyTableButton_Click(object sender, EventArgs e) { TableRichTextBox.Clear(); float number = 0f; if (NumberTableTextBox.Text.Trim() == string.Empty) { MessageBox.Show("Please enter any number to calculate Table", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { number = Convert.ToSingle(NumberTableTextBox.Text); } catch { MessageBox.Show("Invalid Number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } for (int i = 1; i <= 10; i++) { TableRichTextBox.Text += number + " * " + i + " = " + number * i + "\n"; } }
private void ResetTableButton_Click(object sender, EventArgs e) { TableRichTextBox.Clear(); NumberTableTextBox.Clear(); NumberTableTextBox.Focus(); }