Example Code

Limiting Characters in a String

Code and Documents

Attachment

Overview:
This VI shows how to set a limit of the maximum number of entered characters in a String control.
Description:

This VI will only accept characters written to the String control when the limit of characters has not been exceeded, and will discard further key strokes. A "Key Down?" event on the String control is used to register when the user is typing a character. If maximum number of characters is exceeded, the Key Down event will be discarded resulting in no further characters.

Requirements:

  • LabVIEW 2012 (or compatible)

Steps to Implement or Execute Code:

  1. Run the VI.
  2. Specify the maximum number of characters allowed for the String control.
  3. Write some text in the String control and notice how the maximum number of characters can't be exceeded.

 Additional Information or References:Screenshot_1.png

 

Screenshot_2.png

 

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

 

Ben J.
National Instruments
Applications Engineer

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

Comments
labVIEW_Monster
Member
Member
on

Very Handy Thanks for the post

Contributors