LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

read/write a text box

Hi,
I created a piece of code which takes the content of a single line textbox (8 characters) and put it in an array:

char string[9];

memset (stringa, 0, 9);
GetCtrlVal (panel, CTRL, stringa);

After saving the string in a file, I reload it and write it to the same textbox:

ReplaceTextBoxLine (panel, CTRL, 0, stringa);

At this point, if I read again the string, I find the character 'new line' (ASCII code: 10) added at the end of the string.

Does anyone know why ?
Thank you,
Massimiliano Conti.
0 Kudos
Message 1 of 3
(4,366 Views)
In my opinion it depends on the fact that ReplaceTextBoxLine assumes the text box content can be multiline and so adds a new line code to maintain line separation. It is not added if the text box is empty.

In case you want to replace all text box content you can use ResetTextBox, which adds nothing to the string you have passed it it, otherwise you will need to remove the new line code from string end (if present) before saving it to disk.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(4,365 Views)
Thank you !
Now it works very well !
0 Kudos
Message 3 of 3
(4,361 Views)