LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I typecast a particular datatype thru .Net dll?

A little more descriptive version of my problem:

My question is specific to accesing a particular type of data member (public member).

we have two namespaces, a and b. Namespace a is an utility namespace (.Net Assembly)
to hold all the structure declarations,

example:

namespace a
{

public struct FOO
{
public int i;
public short s;
public string st;
}

}


namespace b consists of all the classes and their methods, but has reference to
namespace a for utilizing the structure types:


using a;
namespace b
{
public class class1
{
public FOO foo1; //here we utilize the struct FOO
public Method1()
{
//update member variable foo1 //
return;
}
}

}

Now, in labview I added reference to both of these namespaces (.Net assemblies).
Then I created an instance of the class - class1, call its method (method1). Method1
updates foo1 as expected (I set breakpoint in the dll code). Then the method returns,
I then use a property node to view foo1. The foo1 name shows up in the propertis list,
but I am not able to decode the individual members of foo1 (i, s, st etc).

This is my problem and I am not sure how can I do this. When I use a constructor node
to bring up namespace a, I dont see FOO structure at all.

I would imagine its a fundamental issue in object oriented programming.

If anybody have any idea, please lett me know either here or
via email : mrahman@aerotech.com

Thanks,

Ratin
0 Kudos
Message 1 of 3
(2,692 Views)
Hi Ratin,

I just tested this program out on my computer and I’m guessing you just didn’t wire the foo1 reference into another property node to extract out the individual members of that struct. The foo1 output when you wire it in a Property Node from class1 is simply a reference. You’ll then want to wire that reference into another property node to extract the different members of that FOO struct.

I’ve attached my C# code, .NET assembly reference, as well as LabVIEW program (structTest.vi) to clarify. Let me know if you still have any questions.

Thanks! 🙂

Kileen
Message 2 of 3
(2,669 Views)
Hello Kileen,
I actually did try to reference the individual nodes but when I right clicked on it, it didnt
even bring me a properties node! However after I read your email, I created a new propertioes
node and it seemed to show all the elements. Now I can even get rid of the extra properties
node and it still works. Aparently there were some kind of referencing problem and it went away
with the creation of the duplicated properties node. I will try it again on another PC and see
if I can duplicate it again..

Thanks a lot for your response, I was almost giving up on it .. you showed me the light at the
end of the tunnel 🙂

Ratin
0 Kudos
Message 3 of 3
(2,661 Views)