Reputation: 194
Any ideas on why I am getting this error? I know it may be a simple fix but I'm completely new to C# and I'm unable to find any fixes around.
'SimpleMath.UI.Add_operation.btnCalculate_Click(object, System.EventArgs)' must declare a body because it is not marked abstract, extern, or partial
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System;
namespace SimpleMath.UI
{
class Add_operation
{
public string Calculate(decimal i, decimal j)
{
return (i + j).ToString();
}
private void btnCalculate_Click(object sender, EventArgs e);
}
}
Thanks.
Upvotes: 2
Views: 11501
Reputation: 31897
You need to declare a body in your btnCalculate_Click
method:
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System;
namespace SimpleMath.UI
{
class Add_operation
{
public string Calculate(decimal i, decimal j)
{
return (i + j).ToString();
}
private void btnCalculate_Click(object sender, EventArgs e)
{
// do some stuff here
// or remove the method if it's empty
}
}
}
Upvotes: 2
Reputation: 13600
The error is crystal clear. Your method btnCalculate_Click doesn't have a body!
Upvotes: 0