Example Code

Imposing a limit to user input using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview
This example shows how to limit the user input to controls by using XControl.


Description

This XControl is useful for limiting the number of characters a user can type into a string control. You can download and drop this control into any LabVIEW program.


Requirements

  • LabVIEW Base Development System 2012 (or compatible)


Steps to Implement or Execute Code

To run the example VI:

  1. Download the attached zip file, extract files and open "String Limit 2012 NIVerified.lvproj"
  2. Open "String Limit 2012 NIVerified.vi"
  3. Type in the string box; notice the limit is originally set to 10.
  4. To reset the string limit, set the value of the control, then click the "Run" button.
  5. Click the large "Stop" button; notice the string control maximum length is now set to your value.

 

To use in your code:

  1. Add the XControl to your project
  2. In the project, right-click "My Computer"
  3. Select "Add -> File"
  4. Navigate to where you have saved the XControl and double-click it
  5. Drag the XControl from your project explorer onto your front panel
  6. You will need to initialize the "String Length" property of the XControl in your code via property node.

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Regards
Prabhakant Patil

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.