Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / CARRIAGE RETURN not working in text editor in multiline mode

CARRIAGE RETURN not working in text editor in multiline mode

New Discussion
Ajo
Ajo asked on Aug 16, 2011 5:19 PM

Hi,

We are facing problems with CARRIAGE RETURN in the text editor in multiline mode. If the control is not focused then the control shows the line feeds correct, but as soon as we focus the control it looses the line feed and shows some special characters. we r using Infragistics controls in one of our critcal project. due to this problem our customers are not able to edit text in multiline text box. I dont know why this type of basic problems is coming in a control like text box. From the code I inserted environment.NewLine for carriage return, then also its giving same problem.

Does anyone have the same problem or some idea, please give me reply

Thanks in advance

Ajo

Sign In to post a reply

Replies

  • 0
    Mike Saltzman
    Mike Saltzman answered on Aug 28, 2008 3:11 PM

    Hi Ajo,

    You seem to be using "carriage return" and "line feed" interchangably here. But it's important to understand that they are not the same thing. 

    Anyway… what happens here is that when you click on an UltraTextEditor control and it goes into edit mode, it displays a Microsoft TextBox control and it is this control that can't handle the characters you are giving it.

    I just tested this out and I cannot reproduce this problem, though, either with the MS TextBox or the UltraTextEditor. It seems to work fine with CR of LF or both. Here's the code I used to test it.

                this.textBox1.Text = "A\rB";
                this.textBox2.Text = "A\nB";
                this.textBox3.Text = "A" + Environment.NewLine + "B";

                this.ultraTextEditor1.Text = "A\rB";
                this.ultraTextEditor2.Text = "A\nB";
                this.ultraTextEditor3.Text = "A" + Environment.NewLine + "B";

    What version of the controls are you using? Do you have the
    latest Hot Fix.

    • 0
      Tony
      Tony answered on Apr 8, 2011 7:08 PM

      We have the exact same problem. We are using UltraTextEditor in multiline mode. When the user type some text in multiple lines, if we save the text and re open it, this problem happens. When the user click else where, all text in the textbox wraps in to one line making it unreadable.

      Any solution to this problem from your side? I am sure this is not a Microsoft bug.

      • 0
        Tony
        Tony answered on Apr 8, 2011 7:47 PM

        I think I found the problem. This is not a problem with the control. We are adding the text to xml and then sending it through a webservice. Somehow, on the other end of the web service, the \n\r is getting converted to \n (losing the \r). This is what causing the problem. 

        Ignore my above post.

         

         

      • 0
        Tony
        Tony answered on Apr 8, 2011 8:19 PM

        Well, I think there is something more to this.

        I agree that due to the XML escape issues, the \r\n is getting converted to \n

        But when the control gets focus, it is still able to show them in multiple lines. This means, in the edit mode, the Microsoft TextBox control is able to translate the \n in to new line. But when it loses focus, the UltraTextEditor is not able to do the same, so everything gets wrapped in to single line.

        The right thing to do is, solve the XML escaping issue on our side.

        Next thing should be, the UltraTextEditor should behave the same way as Microsoft Text Editor. It should interpret the \n in to a new line in the control.

        For the benefit of others, we are doing a simple work around to solve this time:

        textEditor.Text = content.Replace("\r\n", "\n").Replace("\n", "\r\n");

         

         

      • 0
        Brian Fallon
        Brian Fallon answered on Apr 11, 2011 2:40 PM

        [quote user="tonymanjaly"] Next thing should be, the UltraTextEditor should behave the same way as Microsoft Text Editor. It should interpret the \n in to a new line in the control.[/quote] I'm not sure what observation you based this on but if you set a TextBox's Multiline property to true and assign the following value:

        this.textBox1.Text = "Line1\nLine2\nLine3";

        It does not interpret the \n as a newline. The correct value to use to get line breaks is "\r\n", which is the value returned from the System.Environment.NewLine property.

      • 0
        Yi
        Yi answered on Apr 15, 2011 10:51 PM

        I'm experiencing exactly the same issue.

        1. Set multiline to true, and set the ultraTextEditor text

        ultraTextEditor1.Text = "Line1\nLine2\nLine3";

        2. when ultraTextEditor1 is in focus, the text looks like:

         Line1Line2Line3

        3. when ultraTextEditor1 lose focus, the text like:

        Line1

        Line2

        Line3

         

        Library:

        Infragistics2.Win.UltraWinEditors.v10.3

        Version:

        10.3.20103.2067

         

         

      • 0
        Mike Saltzman
        Mike Saltzman answered on Apr 18, 2011 2:22 PM

        The the UltraTextEditor is in edit mode, it uses an inbox TextBox control to allow you to edit. This control does not support "\n" by itself. You must use Envorinment.NewLine which is "/r/n"

      • 0
        Linda
        Linda answered on Aug 16, 2011 5:19 PM

        Has there been a resolution to this? I have an untra textbox. I'm using vb.NET. I am building a string of text from multiple strings

        (ex.) str = "ABC" & Environment.NewLine & "DEF" &  Environment.NewLine & "GHI"

        and It shows up ABC||DEF||GHI in edit mode and properly when not.

        Is there a way to show the text properly formatted?

        Nevermind on this. I found the problem but I thought I'd post so maybe it helps someone. My problem was the the strings I am concatonating had embedded CRLF characters and it was the CRLF that was showing up as ||. I added a replace (string, vbCRLF, Environment.NewLine) and the display shows up fine.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Ajo
Favorites
0
Replies
8
Created On
Aug 16, 2011
Last Post
14 years, 6 months ago

Suggested Discussions

Created by

Ajo

Created on

Aug 16, 2011 5:19 PM

Last activity on

Feb 11, 2026 2:38 PM