# HeaderFooter.SectionNumber Property

> Returns the number of the section to which the header or footer belongs. The sections of the document are numbered beginning with 1. This property returns zero, if the header or footer object does not represent a single header or footer.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 14.0
- **Not found:** no package of this release declares this member on this type or on a class it derives from
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.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 for Windows Forms > Reference > TXTextControl > HeaderFooter.SectionNumber Property
- **741 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/headerfooter/sectionnumber-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/headerfooter/sectionnumber-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/headerfooter/sectionnumber-property/llms-full.txt

---

### Description

Returns the number of the section to which the header or footer belongs. The sections of the document are numbered beginning with 1. This property returns zero, if the header or footer object does not represent a single header or footer.

### Syntax

No package of this release declares this member. The declaration below is the reference's, and code that uses it does not compile.

```csharp
public int SectionNumber { get; }
```

```vbnet
Public ReadOnly Property SectionNumber() As Integer
```

### Examples

The following example creates a header for the first section and configures its content or layout by using `HeaderFooter.sectionnumber`.

```csharp
HeaderFooterCollection headers = textControl.Sections[1].HeadersAndFooters;
headers.Add(HeaderFooterType.Header);
HeaderFooter headerFooter = headers.GetItem(HeaderFooterType.Header);
headerFooter.Selection.Text = "Quarterly report";

int sectionNumber = headerFooter.Section;
if (sectionNumber > 0)
{
    Section section = textControl.Sections[sectionNumber];
    Console.WriteLine($"Page width: {section.Format.PageSize.Width}");
}
```

```vbnet
Dim headers As HeaderFooterCollection = textControl.Sections(1).HeadersAndFooters
headers.Add(HeaderFooterType.Header)
Dim headerFooter As HeaderFooter = headers.GetItem(HeaderFooterType.Header)
headerFooter.Selection.Text = "Quarterly report"

Dim sectionNumber As Integer = headerFooter.Section
If sectionNumber > 0 Then
    Dim section As Section = textControl.Sections.Item(sectionNumber)
    Console.WriteLine($"Page width: {section.Format.PageSize.Width}")
End If
```

### Limitations

Read only.

---

## Nearby

- **Previous:** [HeaderFooter.Paragraphs Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/headerfooter/paragraphs-property/llms-full.txt)
- **Next:** [HeaderFooter.Selection Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/headerfooter/selection-property/llms-full.txt)
