annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

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 Compliments
Message 1 sur 3
4 410 Visites
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 Compliments
Message 2 sur 3
4 409 Visites
Thank you !
Now it works very well !
0 Compliments
Message 3 sur 3
4 405 Visites