2
Answers

Delegates and Events

Ask a question
Louise Rains

Louise Rains

14y
2.2k
1

I am working on an application which uses a VB GUI to collect data from the user and pass it to C# classes.  In the VB code I have the following delegate and event:
 

Public Delegate Sub AnalysisDelegate(ByVal theAnalysis as ast.analysis.Analysis)
Public Shared Event OnAnalysisAdded As AnalysisDelegate

When the user creates a new analysis, the analysis should be added to a tree view in the GUI and sent to a C# class called Header.cs, which maintains a list of analyses.  That list is used for activites on the C# side, such as writing an XML file containing the data for later retrieval.
In tracing through the code, the analysis shows up correctly in the GUI, raising events in one class, which are responded to by event handlers in other classes.  However, the data never makes it to the Header class. 
How do I wire up the Header.cs class to listen for the OnAnalysisAdded event from the VB code?
Thanks in advance,
LG Rains

Answers (2)