Visual Basic .NET for LJM - Windows
Visual Basic .NET examples for the LJM library.
Prerequisites
A T-series LabJack Device
LJM Library and .NET assembly - Install the LJM Library
.NET 2.0 Framework or newer for the LJM .NET assembly
Visual Studio 2008 or newer for projects. Code will work with Visual Studio 2005.
Operating system - Windows
Latest Release Example Package
VB_DotNet_LJM_Examples_2024_10_23.zip
New Changes
Initial Visual Basic .NET only release with T7 and T4 examples.
The same examples from the dotnet_ljm_2018_03_14 release.
GitHub
Our latest example changes are available in our GitHub repository.
Instructions
Go to the Quickstart Tutorial for your device and follow the steps to install LabJack software and confirm basic operation.
Download/extract the .zip file attached at the top of this page.
Navigate to the extracted VB_DotNet_LJM_Examples folder.
Open the example projects in Visual Studio to edit, build and run.
Refer to the download's README.txt file for more details.
Where is an example to do XYZ?
You will find lots of examples in this archive, but there is not an example for everything the LabJack can do. The reason for this stems from the "Overview" section above. Most operations simply involve writing and reading different registers, so you really just need examples that show you how to write and read any register. If we had examples for every operation, they would just be copies of the example "Write Read Loop with Config" with different registers. The typical workflow to do almost anything beside stream is:
Look at the T-series Datasheet or the Modbus Map to determine what registers you need to write and read.
Use the Register Matrix in Kipling to test writing and reading your desired registers and confirm you see what you expect to see. This step is optional and not always applicable.
Use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers. Or just use "Write Read Loop with Config", which provides the basic structure used by many user applications.
Code Snippets
Imports LabJack
Module ReadSerialNumber
Sub Main()
Dim handle As Integer
Dim name As String
Dim value As Double = 0
Try
' Open first found LabJack.
LJM.OpenS("ANY", "ANY", "ANY", handle)
' Call eReadName to read the serial number from the LabJack.
name = "SERIAL_NUMBER"
LJM.eReadName(handle, name, value)
Console.WriteLine("eReadName result: ")
Console.WriteLine(" " & name & " = " & value)
Catch ljme As LJM.LJMException
Console.WriteLine("Error: " & ljme.ToString)
End Try
End Sub
End Module
Old Versions
For older versions, go to the deprecated C#, VB .NET for LJM - Windows page.