Hi I'm trying to multiply 2 numbers together in a simple winform application. The method for multiplying is in the class below and then called in the form when you click a button. I have label called answerText and I'm trying to print my answer in that. my line test.multiplynumbers.Tostring is wrong but not sure what to do there?
namespace WindowsFormsApp3
{
class Sums
{
public int multiplynumbers(int num1, int num2)
{
return num1 * num2;
}
}
}
and
namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void AnswerButton_Click(object sender, EventArgs e)
{
Sums test = new Sums();
test.multiplynumbers(5, 2);
answerText.Text = test.multiplynumbers.ToString;
}
}
}