# ParagraphFormat.KeepWithNext Property

> If this property is set to true, the paragraph is displayed on the same page as its following paragraph.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 13.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl > ParagraphFormat.KeepWithNext Property
- **687 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/paragraphformat/keepwithnext-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/paragraphformat/keepwithnext-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/paragraphformat/keepwithnext-property/llms-full.txt

---

### Description

If this property is set to true, the paragraph is displayed on the same page as its following paragraph.

### Syntax

```csharp
public bool KeepWithNext { get; set; }
```

```vbnet
Public Property KeepWithNext As Boolean
```

### Examples

The following example applies paragraph layout to selected report text by using `ParagraphFormat.KeepWithNext`.

```csharp
textControl.Text = "First item\nSecond item\nThird item";
textControl.Select(0, textControl.Text.Length);
ParagraphFormat paragraphFormat = textControl.Selection.ParagraphFormat;

paragraphFormat.KeepWithNext = true;
if (paragraphFormat.KeepWithNext)
{
    Console.WriteLine("Paragraph Format: Keep With Next is enabled.");
}

textControl.Selection.ParagraphFormat = paragraphFormat;
```

```vbnet
textControl.Text = "First item" & vbCrLf & "Second item" & vbCrLf & "Third item"
textControl.Select(0, textControl.Text.Length)
Dim paragraphFormat As ParagraphFormat = textControl.Selection.ParagraphFormat

paragraphFormat.KeepWithNext = True
If paragraphFormat.KeepWithNext Then
    Console.WriteLine("Paragraph Format: Keep With Next is enabled.")
End If

textControl.Selection.ParagraphFormat = paragraphFormat
```

### Remarks

The property's default value is false.

The property returns its default value when the text selection contains multiple paragraphs with mixed setting. The [Selection.IsCommonValueSelected](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/selection/iscommonvalueselected-method/llms-full.txt) method can be used to check for mixed attributes.

---

## Nearby

- **Previous:** [ParagraphFormat.KeepLinesTogether Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/paragraphformat/keeplinestogether-property/llms-full.txt)
- **Next:** [ParagraphFormat.LeftIndent Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/paragraphformat/leftindent-property/llms-full.txt)
