LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.Net object in labview

Hi,

In labview 7.1 and 8.0 the .NET controls are introduced. I found several
examples on how to use a .NET object in labview (calculator, Event callback
for data watcher)) But now I want to create my own .NET object in visual
studio but i don't know where to start...

What kind of project should i use?
Is there somewhere on the internet a visual studio sample code of a .NET
object that i can use in labview?

I'm aware that this might not be the correct newsgroup, but probably there
are some experts here in this group that can answer my question...

Thanx in advance,

Jos Hermans.


0 Kudos
Message 1 of 4
(3,481 Views)
I don't believe there is anything special about creating a .NET class that can be used in LabVIEW since we can access just about any object. If you want a boundary, I would say it should be CLS compliate (Common Language Specification). If you build it with VB.NET or C#, you are going to be fine. If you use C++.NET, you have to be more careful since you can easily create code that isn't CLS in C++.NET.
 
I would recommend picking a C# Command Line project in Visual Studio to get the "Hello World" program working. Just a simple class that outputs some text to the screen. Once you have that down, you want the C# Class Library project to make stuff you can access in LabVIEW.
 
Why C# over VB.NET? Personal preference. I think the C# syntax is easier to learn than VB.NET, but there are a lot of VB programmers out there that would disagree. But either should do the job.
 
Is there something in particular that you are looking to create?
0 Kudos
Message 2 of 4
(3,474 Views)
Thanx, i managed to run my first .net object with your help!

What i'm trying to do:
I've developped an application in Borland builder 6.0 that gave it's
interface through an automation object to an application developped in
labview 6.1. the automation wrapper will control some hardware (2 motors,
some valves, temp sensors, and so on) and the Labview app will monitor
changes in the hardware. This is done on a polling base, because labview 6.1
could not understand the evenhandlers from the Borland generated automation
interface.

Now we have the oppertunity to upgrade both programs to Labview 8 and Visual
studio .net 2005. And of course i want to make my programs up-to-date and
State of the art with the current developpers tools.

Thats why i want to upgrade to .net objects. So what i'm trying to do is to
find out what the benefits are, using .net objects. and especailly using
events, so my labview app is not polling for changes.

Is it a good thing to switch to .net objects? or should i rather use
'oldfashioned' COM objects...

Greetings and thanx for your time.

Jos Hermans.
"Lycangeek" <x@no.email> wrote in message
news:1136473847574-306810@exchange.ni.com...
> I don't believe there is anything special about creating a .NET class that
can be used in LabVIEW since we can access just about any object. If you
want a boundary, I would say it should be CLS compliate (Common Language
Specification). If you build it with VB.NET or C#, you are going to be fine.
If you use C++.NET, you have to be more careful since you can easily create
code that isn't CLS in C++.NET.
> &nbsp;
> I would recommend picking a C# Command Line project in Visual Studio to
get the "Hello World" program working. Just a simple class that outputs some
text to the screen. Once you have that down, you want the C# Class Library
project to make stuff you can access in LabVIEW.
> &nbsp;
> Why C# over VB.NET? Personal preference. I think the C# syntax is easier
to learn than VB.NET, but there are a lot of VB programmers out there that
would disagree. But either should do the job.
> &nbsp;
> Is there something in particular that you are looking to create?


0 Kudos
Message 3 of 4
(3,472 Views)
I'm not exactly sure why you are creating the HW control and UI outside of LabVIEW, but I'm not going to try to make you change :), but I am curious if you don't mind explaining.
 
So, going with .NET for that is definately a good approach over ActiveX. The code is going to be much easier to create and maintain. You are also going to be able to avoid polling, but the events you fire from .NET won't be handled in the LabVIEW event structure. Instead you'll use the LabVIEW event handler. Subtle but important. The LV event structure is used for events generated within LV and the event handler for things generated outside LV - the reasons are a lot of technical issues about threading and avoiding deadlocks, but the end result is what you want - no polling.
 
When you install LV 8 and the .NET framework, go to examples/comm/dotnet and take a look at the various examples there - it shows how to handle events from .NET objects.
 
Let me know if you have more questions.
Message 4 of 4
(3,465 Views)