Options

Carriage Return in text field Problem

distrisoft_larbidistrisoft_larbi Member Posts: 17
Hi all,

I have in my form a text field named Text_SN where :
char10:=10;
char13:=13;
Repeat
Text_SN += Cust."No."+FORMAT (char13)+FORMAT (char10) 
until Cust.next=0; 

The purpose is to have one Customer No per line.

The problem is that my variable is shown in a form like this: AAA◙◙BBB◙◙CCC...
When i copy it to wordpad i got :
AAA
BBB
CCC
...
](*,)
Can any one explain to me how to use a carriage return in a text field ?

10x a lot

Comments

  • PhennoPhenno Member Posts: 630
    Hi all,

    I have in my form a text field named Text_SN where :
    char10:=10;
    char13:=13;
    Repeat
    Text_SN += Cust."No."+FORMAT (char13)+FORMAT (char10) 
    until Cust.next=0; 
    

    The purpose is to have one Customer No per line.

    The problem is that my variable is shown in a form like this: AAA◙◙BBB◙◙CCC...
    When i copy it to wordpad i got :
    AAA
    BBB
    CCC
    ...
    ](*,)
    Can any one explain to me how to use a carriage return in a text field ?

    10x a lot


    Use backslash '\' instead of char(13).
  • distrisoft_larbidistrisoft_larbi Member Posts: 17
    Phenno wrote:

    10x phenno for your answer. it works.
    =D>
  • KAdamsInCoKAdamsInCo Member Posts: 28
    I need to add CR characters to a string as well. I have tried various ways of using the backslash '\' as you suggest with no success. Can you provide a code sample of how to add a CR to a string using backslash?

    Here is an example of what I am attempting to do:

    I := 1;
    WHILE I < 33 DO
    BEGIN
    AlertDisplay1 := AlertString;
    I := I + 1;
    END;
    AlertDisplay1 := AlertDisplay1 + FORMAT(\);

    After the first 33 characters are added to the text variable AlertDisplay1, I want to insert a CR.

    Thanks! :shock:
  • Captain_DX4Captain_DX4 Member Posts: 230
    Instead of:
    AlertDisplay1 := AlertDisplay1 + FORMAT(\);
    
    try:
    AlertDisplay1 := AlertDisplay1 + '\';
    

    The '\' (plain ascii) is interpretted by the Navision GUI interface as a carriage return, but I don't know how it would have interpretted the formatting you were trying to do. Of course, exporting this text to any text editting program (notepad, wordpad) will not give you the results you are looking for (they will all interpret the '\' as a plain \, not a carriage return), so functions to output the text to files need to consider this and strip out the backslashes and replace with the characters for carriage return.
    Kristopher Webb
    Microsoft Dynamics NAV Developer
Sign In or Register to comment.