I have a winapp running with a DLL referenced to it. all the major operations are done in the DLL.
I have like 1000 xml files stored in a location which i have to read and store data into another format.
From the UI, i click on an import button, the call is passed to the DLL layer which converts one xml after another stored at the location in a foreach loop.
In case one xml fails because it is not in proper format, the tool has to display a message in an textbox in my UI but the exception occurs in the dll. The tool has to continue with the other XML’s.
I know through a delegate its possible but am confused on how to use it between the DLL and the UI as the DLL does not have the textbox handle.
thanks…
You need to use events – the relevant class in DLL can define event to signal success/failure of each xml file that UI can handle. Another way would be to accept callback function (delegate) in the method to inform the UI. Here’e the simple sample code:
In DLL:
In UI: