Hello StackOverflow community,
I am working on a .NET windows application in c# and rebuilt one library project to two, as I want to use some classes in another project.
However since my change I get an error as: cannot convert from 'method group' to 'System.EventHandler', when compiling. From a class / method which has always worked.
The application is a complex mapping application which roles out an xml / xsd mapping with objects, parent and sub relationships, default values, list objects and additional features based on automatically read CRM and Webservice WSDL information.
The following line gives the error: "mappingPickListControls = new MappingPickListControls(pMappingPickList, optionMetadataCollection, ValidationRegister, imglblMandatory, tbControlToValidate_validating);"
The eventhandler is given to the control builders to ensure the method can be called by the correct control to validate the correct information.
CRMMappingPickListForm:
private void tbControlToValidate_validating(object sender, CancelEventArgs e)
{
ValidateControl(this, (Control)sender);
}
public CRMMappingPickListForm(Ciber.Crm.MappingCRMTo.Data.CustomOptionMetadataCollection optionMetaDataCol, Point location, Size size)
{
InitializeComponent();
this.Location = new Point (location.X + (size.Width / 2) - (Size.Width / 2), location.Y + (size.Height / 2) - (Size.Height / 2));
optionMetadataCollection = optionMetaDataCol;
ValidationRegister = new FormValidationRegister();
ValidationRegister.ControlValidationRegister.Add(new ControlValidation("tbConfigurationName", 1, "configuration name", 1));
mappingPickListControls = new MappingPickListControls(pMappingPickList, optionMetadataCollection, ValidationRegister, imglblMandatory, tbControlToValidate_validating);
}
MappingPickListControls:
public MappingPickListControls(Panel pMappingPickList, CustomOptionMetadataCollection optionMetaDataCol, FormValidationRegister ValidationRegister, Bitmap imglblMandatory, EventHandler tbControlToValidate_validating)
{
lblPickListValueList = new List<Label>();
tbPickListMappedValueList = new List<TextBox>();
foreach (CustomOptionMetadata optionMetaData in optionMetaDataCol)
{
AddMapping(pMappingPickList, optionMetaData, ValidationRegister, imglblMandatory, tbControlToValidate_validating);
}
}
I got 3 projects in my solution:
MappingCRMTo: Has all the windows forms including the CRMMappingPickListFOrm MappingCRMTo.Controls: Has all the form extensions and form related classes. This is the new project library I created. It also includes MappingPickListControls, which is one of the control builder classes. MappingCRMTo.Data: Has all serialization objects, WSDL reader, zip creator and other classes I like to use throughout some other projects. It is the old location of MappingPickListControls