private void addButton_Click(object sender, EventArgs e) { double num1, num2; if (Double.TryParse(num1TextBox.Text.Trim(), out num1) && Double.TryParse(num2TextBox.Text.Trim(), out num2)) { descriptionLabel.Text = string.Format("This function adds up {0} and {1}.", num1, num2); resultTextBox1.Text = string.Empty; resultTextBox2.Text = string.Empty; resultTextBox3.Text = string.Empty; var result = _simpleMatlab.AddScalars(num1, num2); resultTextBox1.Text = string.Format("The sum of {0} and {1} is {2}", num1, num2, result); return; } resultTextBox1.Text = @"Wrong input"; resultTextBox2.Text = string.Empty; resultTextBox3.Text = string.Empty; }