Hi there! I'm fairly new to C# programming.
I am making a program for fun that adds two numbers together, than displays the sum in a message box. I have two numericUpDowns and a button on my form. When the button is pushed I want it to display a message box with the answer.
The problem is, I am unsure how to add the twp values from the numericUpDowns together.
So far, I have this in my button event handler:
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(this.numericUpDown1.Value + this.numericUpDown2.Value);
}
But obviously, it does not work. It gives me 2 compiler errors: 1. The best overloaded method match for 'System.Windows.Forms.MessageBox.Show(string) has some invalid arguments 2. Argument '1': cannot convert decimal to 'string'
Thanks!