LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C# code in LabVIEW

Hi

 

We have many C# project and I would like to integrate them in LabVIEW . Each C# projects contains thousands of lines, many classes and forms. Could you please help me on this?

 

I have found this article very helpful, however it is very basic.

http://erdosmiller.com/blogs/news/6605401-integrating-labview-and-c-1 

 

I really need some guidlines on how to start?

I would greatly apprecaite your help

 

Thanks,

Message 1 of 15
(7,222 Views)

Any help is really appreciated. For example when I would like to use an object of class using the link in  previous post I always see many constructors. Default and override ones. How can I implement inheritance in LabVIEW

0 Kudos
Message 2 of 15
(7,032 Views)

Can you be more clear about what you are trying to do? As the link you posted explains, if you have C# code that you want to call from LabVIEW, you need to build that C# code into DLLs. I don't understand what you mean about implementing inheritance in LabVIEW; the inheritance is all handled on the C# side. It might help to show a screenshot of the LabVIEW behavior that you find confusing, if possible.

0 Kudos
Message 3 of 15
(7,011 Views)

hi all 

 

i also have some problem in learing from labview learning manuals , i can not find examples for practice like C:\Exercises\LabVIEW Basics I\Temperature Multiplot 

 

and more ,,kindly help to find a solution

0 Kudos
Message 4 of 15
(6,994 Views)

danishasefi: Your question has absolutely nothing to do with this thread. Please do not hijack another persons thread, create your own.

 

To answer your question, have you installed the LabVIEW Basic Course DVD ? You need to install the course DVD to get the exercises for the course. The DVD should be together with your course material.

0 Kudos
Message 5 of 15
(6,963 Views)

hi nathand

 

The first problem is when I call the constructor and then an invoke node I get the following error. Could you please help me to fix this error

 

 

Error 1172 occurred at Invoke Node Error calling method MotionSense.TestStation.ELD.CELDTestBench.onVdd, (System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
Inner Exception: System.NullReferenceException: Object reference not set to an instance of an object.)

Possible reason(s):

LabVIEW: A .NET exception occurred in an external assembly. For information about correcting this error, copy the following exception (in bold), and search the Microsoft Developer Network (MSDN) Web site or the Web for a possible explanation.
System.NullReferenceException in

0 Kudos
Message 6 of 15
(6,941 Views)

This is an error in the C# code, not LabVIEW. You'll need to work with the C# developer to identify the problem. Perhaps you need to do some other initialization of the object before calling that method?

0 Kudos
Message 7 of 15
(6,936 Views)

0 Kudos
Message 8 of 15
(6,870 Views)

Let me use an example.

 

Somewhere in the code I should use the constructor of a class called NIAnalogOutput and then call the methods inside this class

 

as can be seen below inside the constructor it uses 2 objects from other classes: clsSystemInfo and SystemBusType

 

If I delete that line and then compile and use the dll file I don't get any error

However if I keep this line in the constructor and compile the code I will get 1172 (null reference error )

 

I even tried to call the constructor of these classes and then call NIAnalogOutput but I still get the 1172 error. Could you please help me on this? How can I get rid of the error in this example?

 

in the attached picture you can see that I call the 2 class constructors  (then all pass OK) before callingNIAnalogOutput

but I still get an error from  NIAnalogOutput constructor

 

public NIAnalogOutput(string[] DeviceAndChannelName, double maxVal, double minVal, bool isMaster = false, eNIAOutCalOpt eCalOption = eNIAOutCalOpt.USE_STATIC)
        {
            this.master = isMaster;


            if (eCalOption != eNIAOutCalOpt.NONE)
            {
                // Go change the niScales to either the static brdOffset values, or immediately measured values
                UpdateAnalogOutputBoardOffset(eCalOption);
            }
            Dictionary<string,List<string>>devicesAndChannels = new Dictionary<string,List<string>>();
            List<string> devices = new List<string>();
            List<string> tmpChannels;
            string[] tmpString;
            int key_idx = 0;
            NrOfChannels = DeviceAndChannelName.Length;
            rNum = new Random(Environment.TickCount);
            int chanIndex;
//#if PCI
            if (clsSystemInfo.DAQmxInfo.sysBusType == SystemBusType.PCI)
            {
                SyncSignal = "RTSI5";  //not functional yet!!!
                SampleClkSignal = "RTSI4";
                GlobalSyncSignal = "RTSI3";
            }

}

 

0 Kudos
Message 9 of 15
(6,861 Views)

Basically the problem is how to manage dependency between c# classess in LabVIEW. In c# "using take care of dependencies" and I thought when I create a dll all these dependencies will be added and LV doesn't care about dependencies inside this dll

0 Kudos
Message 10 of 15
(6,833 Views)