.Net object in labview

J

Jos Hermans

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?

Thanx in advance,

Jos Hermans.
 
G

Guest

Hi,

the best thing to do would be to use C# to create a .NET dll.
start from a new C# dll project, add a Hello World class and take it from
there.
there are lots of good articles to be found on the internet. one of the
places you can go is www.codeproject.com, and of course in MSDN.

C# is a good choice because it was created for .NET, and it is relatively
easy to learn if you know C++ or another object oriented language.

incidently, i am a developer for a NI alliance member, so if you have
problems with the LabVIEW bindings i can help you with that too.

kind regards,
Bruno.
 
J

Jos Hermans

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.
 
B

Bruno van Dooren

In my experience with LabVIEW, i can tell you: stay as far away as possible
from COM and ActiveX.
the problem with those is that they need to be registered in the registry
for LAbVIEW to use them properly.
even then, this will not work on some computers, without anyone ever knowing
why.

..NET is much better in this regard. it will work without much hassle. the
only thing you have to keep in mind is that data types have to be converted
between LabVIEW and .NET. this happens automatically, but has a performance
impact. if you need a way to stream 200 KB per second from one to the other,
you might want to use plain C/C++ dlls. other than that, you should be fine.

another advantage is that you can use the .NET framework in your own code.
the .NET framework is huge, and has lots of very cool features. also, lots
of hardware suppliers (like national instruments itself) are moving away
from COM to .NET because it combines ease of use and power.

using LabVIEW event handlers has less overhead than polling, but keep in
mind that debugging can become harder, especially if you have lots of events
that can get triggered simultaneously. other than that, events are very nice
to use.
also, remember to check which references you have to close explicitly, and
which are closed for you by LabVIEW, because you could have memory leaks
otherwise.

kind regards,
Bruno.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top