From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Restricting text entry in string control to say 10 chars

How can I do this?

One way would be to capture key entry events and swallow the event after 10
chars have been entered. Is that the only way?


vishi
0 Kudos
Message 1 of 4
(2,845 Views)
Go to this link... there's answer to ya Q

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000E72C0000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=%22length+of+string%22+limit&USEARCHCONTEXT_QUESTION_S=0

ian.f
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 2 of 4
(2,844 Views)
Hi!,

Did someone find an answer to the above discussion? The link from ian.f does not work.

I have exactly the same issue and would appreciate a way out. The requirement is NOT to read 10 chars. BUT, to restrict entry itself once the user reaches the specified number of characters. Something similar to the upper and lower limit setting in a numerical control box.

Thanks!

- Gurdas
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 3 of 4
(2,824 Views)
Gurdas,
As far as I know...there is not a simple option that will allow you to do this. What you can do is, as you said, capture the event, check the number of characters with string length, then truncate when that number is greater than 10. Make sure you have selected the "update value while typing" from the right-click menu on the string control.

I have attached a simple example for LV 7.1 that performs this task....

cheers,
-Brett
Message 4 of 4
(2,819 Views)