Adding Carriage Return Line Feed to Informational Messages

Is it possible to add carriage return / line feed to informational messages to structure them better?

where are you generating the message? BPM? or C# from a customization?

If it’s from code, I’m pretty sure Environment.NewLine should do the trick.

1 Like

That link shows using either Environment.NewLine or "\r\n".

I’m old school (K&R C), so I use the "\r\n". Any down side to using that, over the “Environment” object?

I’m pretty sure it’s a memory thing…

As in, “I can remember that Environment.NewLine makes a new line” because it’s obvious.

I’m new school, as in, “so new I don’t really know what’s going on”, I just know that this worked for me in the past. :wink:

But from my limited reading, I don’t think it really matters.

@ckrusen “\r\n” is specific to a Windows Box in a specific encoding. Environment.NewLine is smart enough to work across platforms, encoding and such. Think Unix, vs Windows, vs Linux
For the most part one should avoid “magic strings”


It’s all a bunch of flippin wizardry around here though… lol

To add to this issue, ( I do use Environment.NewLine and it works great… ) but then again I had similiar issue but within my reports… adding comments… the text was never shown with the “newline”.

So I had to create a function in the Code section of the report properties and that worked.:

Public Function SplitComments(ByVal str As String) as String
Dim c() As String = Nothing
dim s as string = ""
c = str.Split(vbcrlf)
Dim i As Integer
For i = 0 To c.Length - 1
If i > 0 Then
s = s & vbCrLf & c(i)
s = c(i)
End If 
return s
End Function

and my text object expression would be:
=Code.SplitComments(your field value )


What works in form code? I’m trying to display the ShipTo address but + Environment.NewLine + doesn’t do anything and seems ignored as everything is bunched together.

			if ((edvOrderHedRow != null))
				edvOrderHedRow["InstallShipTo_c"] = adapterRow["ShipToNum"];
				edvOrderHedRow["Character07"] = adapterRow["Name"] +  Environment.NewLine  + adapterRow["Address1"] ...  [Country];


Is that control setup with Multiline enabled?



Well :poop: That’s what I get for using an existing field.

But you made it taller! Shouldn’t it have known to automatically enable Multiline? :wink:

When I am building a larger string out of multiple smaller ones, and I want line breaks, I use a “stringbuilder” statement, which has an AppendLine feature. stringbuilder is more efficient with memory than simply appending strings over and over again. - check out: C# StringBuilder Examples - Dot Net Perls & C# StringBuilder Append and AppendLine - Dot Net Perls

1 Like

I actually didn’t it was already that tall but wider so still no excuse.

Thanks @timshuwy I got it working with stringbuilder.

1 Like