Adding new line to rich text box in c# - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Adding new line to rich text box in c#

Last post 05-19-2019 11:25 PM by MaroHamamjyan. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 02-05-2016 07:57 AM

    • waelt
    • Not Ranked
    • Joined on 01-26-2016
    • Posts 13

    Adding new line to rich text box in c#

    I'm trying to add a new line in a RichTextBox using the following: execSummary = execSummary.Replace(";", System.Environment.NewLine); //execSummary is a string I'm trying to replace every semi-column with a new line when the user presses a button, but what happens is that the semi column will only disappear and have a white space instead. Is there anyway I can add a new line using c#, or can I do it without coding? What is weird, when I show the modified text in a message box it is showing as it should be! But not when I check the rich text box .... o.O Thank you
    Filed under:
  • 02-05-2016 08:15 AM In reply to

    Re: Adding new line to rich text box in c#

    Open the XML in a text editor and look at some rich text with line breaks. :) It is XHTML. You'll need to replace your ";" with "<br />" instead I think.

    EDITED to add the "<br />" back in, since the browser ate it. 

    Hilary Stoupa

  • 02-05-2016 08:25 AM In reply to

    • waelt
    • Not Ranked
    • Joined on 01-26-2016
    • Posts 13

    Re: Adding new line to rich text box in c#

    I tried that, but the form is typing
    instead of a new line.. I can add them manually but it is not working that way... weird
  • 02-05-2016 08:32 AM In reply to

    Re: Adding new line to rich text box in c#

    I think you have to get the inner xml of the node - then do your replace, then set the inner xml of the node....
    Hilary Stoupa

  • 02-05-2016 08:37 AM In reply to

    • waelt
    • Not Ranked
    • Joined on 01-26-2016
    • Posts 13

    Re: Adding new line to rich text box in c#

    Do you have any example that can help me out ?
  • 02-05-2016 08:50 AM In reply to

    Re: Adding new line to rich text box in c#

     Check this site: http://www.bizsupportonline.net/use-rich-text-box-infopath.htm

    It says InfoPath 2007, but will be pretty much the same for 2010 and 2013. 

    Hilary Stoupa

  • 05-19-2019 11:25 PM In reply to

    Re: Adding new line to rich text box in c#

    Is there a way to get new line in rich text box without using C#? I need to work in InfoPath, would like the rule to work when a button is clicked. I tried XML but it didn't work. Do you have any smaple that would work just in InfoPath maybe from reading new line command from other source?
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.