I'm reviving the thread because I find it adequate to the problem i had - how to limit character length in string control and because the suggested solutions to the problem were using event structure which I was trying to avoid. The code was tested on LV2012. Run the vi input the desired maximum string length in to the MaxLength control delete the current STRING string from TextBox control then type some text in TextBox control. Observe that the TextBox control does not accept more than MaxLength characters.
Reviving the old thread AGAIN as this seems the most pertinent place to post this addition
If wanting to limit input string length on one input it is possible there are a number of other string inputs on the same screen. Setting intelligent tabbing order between the controls makes the operation a little more slick. I found that if the input is full (to the prescribed string limit) then tab does not execute. The image attached shows one way of getting around this. Setting a key focus for the Tab key character code overrides the discard switch that appears to be getting 'stuck'.
There is a further improvement required that hopefully someone can contribute to, the key focus property only works if the next control is enabled. My question is;
Is there a method to select the next enabled control in the tabbing order rather than selecting or choosing a specific key focus?
I think that my solution below should solve the problem with the tab key. It just adds a check to see if the tab key is pressed and then does not discard it so that it acts as it normally should.
I hope this helps.