From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-02-2021 06:15 PM
Hi
i get a .NET DLL and it's my first time to work with it in LV. At first I've a constructor of a class. With an Invoke-Node I call a method of this class. The input to class is an array ( just to pass the value from 0 to 20) in form of ref. I tried to input the array using Net to object vi and To more specific class. I applied the output of To more specific class to ref input. I am still getting am error "1057" at To more specific class vi. Can anyone help me.
Thanks a lot.
Regards.
04-03-2021 06:53 AM
Your description makes it sound like you've gotten something backwards... but I guess if you'd chosen the wrong nodes, you wouldn't be able to wire it at all.
Once you have the .NET reference from "To .NET Object", you might be able to pass that reference directly.
If the type won't fit the Invoke Node, then you need a .NET class to cast it to (as you're describing, I think...) but I guess the top input to your More Specific Class node is wrong.
Can you post your VI or a snippet?
04-03-2021 02:10 PM
Hi
Thanks for replying my message. I tried to input the array as ref input from some previous messages. Please find the enclosed doc having C# code and what I tried.
If there is some example related to issue, please let me know.
Thanks in advance.
regards.
Gurjit
04-03-2021 10:10 PM - edited 04-03-2021 10:11 PM
04-04-2021 03:13 PM
Hi
I receive an error 1057. Could you please let me know how to pass the array. I am trying .NET application with labview first time.
Thanks a lot for your help.
Regards.
Gurjit
04-05-2021 12:09 PM
@cbutcher wrote:
Looks like you're passing the type from Get Type to the Open function. You need to pass the array instead.
Cbutcher already told you! You're passing the Type in, not the array. Just get rid of the "object.GetType" node and wire it directly!
04-05-2021 12:53 PM
Hi Kyle,
I tried some ways but didn't work. Could you please let me know, how to connect Array to ref without object.GetType. Please find the enclosed .dll file.
Reagrds and Thanks.
04-05-2021 09:50 PM
Here's my snippet showing my attempt.
I created the To More Specific Class constant by right clicking the sfTypes input and then creating a constant, then rewiring it to the top of the To More Specific Class node.
You can see here there isn't any problem with the cast - the problem occurs in the library function where an exception is thrown - I expect because it has some dependencies that can't be found from my Downloads folder, or because some other assembly needs to be registered.
The exception message was:
Retrieving the COM class factory for component with CLSID {9F8D4F16-0F61-4A38-98B3-1F6F80F11C87} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).)
I didn't close the Array reference here, but you might need to do so - if you do, ensure that the Close Reference happens after anything in your DLL uses it (i.e. put appropriate error wires in to sequence the CR. In your docx file, there was no dataflow dependency that would ensure the Open finished before the Close Ref of the Object/Array.
04-06-2021 06:29 AM
Hi,
It's working fine. Thanks for your help.
Regards.
04-06-2021 06:56 AM
Hi Kyle,
How I can input command: string inXml = "<inArgs>" +
"<scannerID>" + scannerId.ToString() + "</scannerID>" +
"</inArgs>"; input for the next command.
I tried by copy the whole command in string control inXML. I am getting error 1.
Regards .