# EndOfLine Adding extra blank line

**URL:** <https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935>\
**Category:** General\
**Created:** [September 26, 2026, 6:20pm UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935 "2026-09-26T18:20:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_McDonald](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@John\_McDonald](https://forum.xojo.com/u/John_McDonald)\
**Post date:** [September 26, 2026, 6:20pm UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/1 "2026-09-26T18:20:16Z")

</div>

```auto
// Variable Declarations
'Var sLineEndNo As String = txtDetails.Text'.ReplaceLineEndings( "" )

// The code... the code that should work!
If( txtDetails.Text = "" )Then
  txtDetails.Text = Me.Text
Else
  txtDetails.Text = txtDetails.Text + Me.Text + EndOfLine
End If

Me.Text = ""

```

 ![Screenshot_20260926_110645](https://forum.xojo.com/uploads/default/original/3X/2/9/296eac78bbdd74ca38521d297f9f73a72e07bdb7.png)

The code and a screen shot of the issue. The first 2 lines are as wanted, then the following lines have a blank space that I dont want.

---

<div class="post-metadata">

**Author:** ![Gilles\_Plante](https://forum.xojo.com/user_avatar/forum.xojo.com/gilles_plante/32/667_2.png) [@Gilles\_Plante](https://forum.xojo.com/u/Gilles_Plante)\
**Post date:** [September 26, 2026, 11:03pm UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/2 "2026-09-26T23:03:35Z")

</div>

Hi,

See from the documentation [https://documentation.xojo.com/api/text/endofline.html#api-text-endofline-usage](https://endofline)

You did not specify the OS you are working on. As you can see, on some OSs, `EndOfLine` adds a corriage CR/ **LF** and others a single CR. That may explain the additionnal LF.

The control that displays the contents of txtDetails probably extends CR into CR/LF by itself, so CR/LF will add a cecond LF.

---

<div class="post-metadata">

**Author:** ![John\_McDonald](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@John\_McDonald](https://forum.xojo.com/u/John_McDonald)\
**Post date:** [September 26, 2026, 11:11pm UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/3 "2026-09-26T23:11:12Z")

</div>

Linux, that"a all I use or write for. I’ll read up.

---

<div class="post-metadata">

**Author:** ![Stefan\_von\_Allmen](https://forum.xojo.com/letter_avatar_proxy/v4/letter/s/e5b9ba/32.png) [@Stefan\_von\_Allmen](https://forum.xojo.com/u/Stefan_von_Allmen)\
**Post date:** [October 1, 2026, 8:39pm UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/4 "2026-10-01T20:39:16Z")

</div>

How is your code triggered? I’d guess, it is the code line `Me.Text = ""` that adds the empty line to `TextDetails`.

---

<div class="post-metadata">

**Author:** ![Mark\_Sweeney](https://forum.xojo.com/user_avatar/forum.xojo.com/mark_sweeney/32/3332_2.png) [@Mark\_Sweeney](https://forum.xojo.com/u/Mark_Sweeney)\
**Post date:** [October 2, 2026, 12:37am UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/5 "2026-10-02T00:37:06Z")

</div>

I don’t know what the contents of `Me.text` is, but if you may want to use TrimRight on it to remove any line endings/white space characters at the end of it.

```auto
If( txtDetails.Text = "" )Then
  txtDetails.Text = Me.Text.TrimRight
Else
  txtDetails.Text = txtDetails.Text + Me.Text.TrimRight + EndOfLine
End If

Me.Text = ""

```

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [October 2, 2026, 4:07am UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/6 "2026-10-02T04:07:15Z")

</div>

> [@Stefan\_von\_Allmen](#):
>
> `Me.Text = ""`

If Me is a TextArea | TextField, this code clears the Control Text contents.  
Unless Xojo recent change…

BTW: Isn’t that an API I code ?

---

<div class="post-metadata">

**Author:** ![John\_McDonald](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@John\_McDonald](https://forum.xojo.com/u/John_McDonald)\
**Post date:** [October 2, 2026, 6:15pm UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/7 "2026-10-02T18:15:38Z")

</div>

Thank you, I’ll give the TrimRight a try and see if that resolves the problem.

The code is triggered by a ComboBox.TextChanged event. The ComboBox is loaded via code with pre-select statements that I can use to fill a TextArea with. Sometimes there is only one selection other times I might make 4 or more.

Okay, so I tried Trim, TrimRight and both give the same result. A single line with no carriage return. I am really stumped why this is not working as planned.

---

<div class="post-metadata">

**Author:** ![John\_McDonald](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@John\_McDonald](https://forum.xojo.com/u/John_McDonald)\
**Post date:** [October 2, 2026, 6:21pm UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/8 "2026-10-02T18:21:14Z")

</div>

Using Linux. I specified all the various return types just to see if that would solve the problem. It does not. What does not make sense is the first two lines are exactly as expected, but when I add a third line or more the results add an extra blank line.

---

<div class="post-metadata">

**Author:** ![John\_McDonald](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@John\_McDonald](https://forum.xojo.com/u/John_McDonald)\
**Post date:** [October 2, 2026, 6:21pm UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/9 "2026-10-02T18:21:42Z")

</div>

Me.Text is a ComboBox

---

<div class="post-metadata">

**Author:** ![Stefan\_von\_Allmen](https://forum.xojo.com/letter_avatar_proxy/v4/letter/s/e5b9ba/32.png) [@Stefan\_von\_Allmen](https://forum.xojo.com/u/Stefan_von_Allmen)\
**Post date:** [October 4, 2026, 12:44pm UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/10 "2026-10-04T12:44:11Z")

</div>

> [@John\_McDonald](#):
>
> The code is triggered by a ComboBox.TextChanged event.

Ok, and assigning to `Me.Text` triggers the TextChanged event, or doesn’t it?. On the other hand, I wonder why you don’t get an infinite loop …

You might want to suppress adding text to `txtDetails`if Text is empty. And don’t reset the text, even if it is empty already.

---

<div class="post-metadata">

**Author:** ![John\_McDonald](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@John\_McDonald](https://forum.xojo.com/u/John_McDonald)\
**Post date:** [October 6, 2026, 3:28pm UTC](https://forum.xojo.com/t/endofline-adding-extra-blank-line/88935/11 "2026-10-06T15:28:17Z")

</div>

I just figure out where the blank line is coming from… derp! When I set the value Me.Text to “” it triggers the event again. Problem solved,
