LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string control input validation

What is the best way to validate a user input in a string control? I want to limit the user to only inputting a valid serial number sequence. If the digit being entered has to be numeric, i only want them to enter a digit at that position in the field.
0 Kudos
Message 1 of 5
(4,316 Views)
I would suggest using the event keydown? and keyrepeat? filter events on the string control.

That way you are able to see what key they pressed before it actually gets displayed in the string.

If it is valid wire a false to the discard terminal, otherwise send a true.

That way when they type an incorrect character you can ignore them. However, keep in mind this is character by character. Except for the keyrepeat, which is a key being help down, which you most liekly want to ignore as well.
Message 2 of 5
(4,316 Views)

I apologize far tagging onto a previous post, but I could not find where to post my own 'new' question - very frustrating.  Anyway, here is my related question.  I have a data entry field where the operator can enter upto 15 characters.  Each character can have values 0 to 9.  Unused digits must be set to 'F'.  Ideally, I can have one text entry field that somehow checks each character (real time), as it's being entered, and limits the operator to a valid digit, else 'F'.  If not one field, then I have to have 15 seperate fields (or drop downs) each of the same type(def), but somehow each would have the same real-time limitations.  Any thoughts?

0 Kudos
Message 3 of 5
(3,277 Views)

convert your string to byte data then you can use in range
check this example

Message 4 of 5
(3,267 Views)

Hi bean,

 

but I could not find where to post my own 'new' question - very frustrating.

Well, when you are logged in to the forum then there is a "Start new topic" button right at the top!

check.png

It's so easy… 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 5
(3,254 Views)