Spaces in a filed text

I'm having a problem in text fields that come from the MySql database.
I'm using the following statement:
EXEC SQL SELECT bdname INTO wrk-name FROM Costumer (the wrk-name is the PIC X (50).
Then I'm using:
set txtName:: Text to wrk-name
What happens is that the campio txtNAME is completely filled (50 characters) not allowing write nothing but nullifying the blank spaces.

How can I resolve the issue?

(Visual Cobol 2.2 with WPF)

  • Verified Answer

    If you are trying to suppress trailing spaces in a text field you could set it using the TrimEnd method like:

    set txtName::Text to wrk-name::TrimEnd

    TrimEnd is actually a method on the string class but it can be used on pic x items as well as they are treated as strings behind the scenes.

  • Thanks for your flash response. It´s working.

    I should like to put two little questions:

    -Is there any way to create numeric only fields?

    -Is there any way to create an input field for dates where the user only put the month and year and assume the system "/".

    In NetExpress created the field with 99/99/9999 Pic. Is there anything like that?

  • What you are looking for is a MaskedTextbox control. There is not one provided in the default WPF control collection but there is one available in the  Extended WPF Toolkit which can be downloaded here:

    The NuGet package manager does not currently work with Visual COBOL but you can download the toolkit binaries and then add the controls to your Toolbox following the instructions here

    This will allow you to create entry fields that support the insertion of literal characters as well as allowing only specific characters to be entered.