Skip to main content
Skip table of contents

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

  1. Go to the Quickstart Tutorial for your device and follow the steps to install LabJack software and confirm basic operation.

  2. Download/extract the .zip file attached at the top of this page.

  3. Navigate to the extracted VB_DotNet_LJM_Examples folder.

  4. 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:

  1. Look at the T-series Datasheet or the Modbus Map to determine what registers you need to write and read.

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

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

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

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.