Overload Error C #

0

I have the following error CS0123 No overload for 'lsvRecebeGrupoLayout_ItemCheck' matches delegate 'ItemCheckEventHandler' in the code below, any suggestion of what might be causing this error?

private void lsvRecebeGrupoLayout_ItemCheck(object sender, ItemCheckEventArgs e, CheckBox cb)
{
    GrupoLayout gp = new GrupoLayout();
    RepositorioGrupoLayout r = new RepositorioGrupoLayout();
    Layout lay = new Layout();
    cb.Checked = Convert.ToBoolean(gp.Id);
    lay.Id = Convert.ToInt32(cb.Checked);
    r.Alterar(lay.GrupoLayout);

}
    
asked by anonymous 06.10.2017 / 14:36

1 answer

3

This happens because its lsvRecebeGrupoLayout_ItemCheck is a method whose signature is not valid to be a handler of the ItemCheck event.

According to specification , the method signature must contain only object and ItemCheckEventArgs

How to solve?

Remove the Checkbox cb of the signature. You do not need it there, because it's your sender , just cast:

var cb = (CheckBox)sender;

    
06.10.2017 / 14:45