当我尝试运行我的代码时收到此消息,我知道它不完整。
错误 1 'CalculateGrossPay_Click' 没有重载匹配委托 'System.EventHandler' C:\Users\Jose A Soto\Desktop\Windows Forms Application\Windows Forms Application3\Form1.Designer.cs 169 WindowsFormsApplication3 46
这是我双击错误时显示的代码行:
this.CalculateGrossPay.Click += new System.EventHandler(this.CalculateGrossPay_Click);
我也无法显示任何东西。
public partial class Form1 : Form
{
private string name;
//private decimal;
//private decimal;
public Form1()
{
InitializeComponent();
}
private decimal CalculateGrossPay_Click(decimal hours, decimal rate)
{
decimal result=0.00m;
decimal standardHours= 0.00m;
decimal overtimeHours=0.00m;
if (hours > 40)
{
overtimeHours = (hours - 40) * ( (rate) * 1.5m);
standardHours = 40 * rate;
DisplayOutPut.Text = name+ NameTextBox.Text + "";
DisplayOutPut.Text = "Gross Pay:" + result;
}
else
{
standardHours = hours * rate;
DisplayOutPut.Text = "Hours:" + HoursTextBox.Text;
DisplayOutPut.Text = "Rate:" + RateTextBox.Text;
}
result = standardHours + overtimeHours;
return result;
}
}