LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Callback VI as parameter for .net function

Hi,

I started using the Xml classes of the .net framework.  For my class I need a way to validate the existent DOM. This should happen when the XML file is loaded and also when new nodes are inserted into the DOM. The first part could be covered by XmlValidatingReader which is already working for me by the help of the Reg Event Callback node from LabVIEW. The second part seems to be more difficult. I'm operating on an instance of XmlDocument which provides a function Validate. It requires a parameter of the type ValidationEventHandler. I want to use the same callback VI from XmlValidationReader (see attached image). Looking at the C++ code you can see following:

ValidationEventHandler eventHandler = new ValidationEventHandler(ValidationEventHandler);
document.Validate(eventHandler);

static void ValidationEventHandler(object sender, ValidationEventArgs e)
{
  ...
}

The Validate funcion requires an instance of ValidationEventHandler which is constructed with the pointer to the callback function. Using the same way in LabVIEW shows me a constructor with two parameters? Why that? How can I assign my already existing callback VI to the new ValidatingEventHandler instance? I cannot find a way.

Regards
Henrik
Download All
0 Kudos
Message 1 of 3
(2,739 Views)
The easiest that comes to mind (haven't done it in a while) is to open the Callback VI created by LV and call your own callback VI from there.

You could try to match the connector panes and drag and drop you VI into the Callback-reference

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 3
(2,733 Views)
The callback vi which I use is already the automatically created one by LabVIEW. But the vi reference is not compatible with the validationEventHandler parameter of the validate function. Using the constructor of ValidationEventHandler has two parameters and not one. I don't know what I have to pass here.

Henrik
0 Kudos
Message 3 of 3
(2,729 Views)