---
title: roRegistrySection
slug: develop/roregistrysection
docTags: 
createdAt: 2025-03-11T07:07:17.200Z
---

This object represents a section of the registry, enabling the organization of settings within the registry. It allows the section to be read or written. The JavaScript equivalent is [registry](docId\:tXWoOMbD2-u12dfegX7gA) (see [BrightScript-JavaScript Migration Guide](docId:2KEwWxLmpYcwu8tffuf2Z) for the method equivalents).

Object Creation: This object must be supplied with a registry-section name upon creation.

```text
CreateObject("roRegistrySection", section As String)
```

Writes do not always take effect immediately to prevent the system from exceeding the maximum number of writes on the onboard persistent storage. At most, 60 seconds after a write to the registry, the newly written data will be automatically written out to persistent storage. If, for some reason, the change must be written immediately, then the `Flush()` method should be called. All changes will be written automatically prior to exiting the application.

## ifRegistrySection

### Read(key As String) As String

Reads and returns the value of the specified key. Performing `Read()` on an entry that does not exist, or on a key within a section that does not exist, will return an empty string ("").

### Write(key As String, value As String) As Boolean

Replaces the value of the specified key.

### Delete(key As String) As Boolean

Deletes the specified key.

### Exists(key As String) As Boolean

Returns True if the specified key exists.

### Flush() As Boolean

Flushes the contents of the registry out to persistent storage.

### GetKeyList() As roList

Returns a list containing one entry per registry key in this section.

### Example

```text
registrySection = CreateObject("roRegistrySection", "widget-usage")
' An empty entry will read as an empty string and therefore be converted to zero.
hits = val(registrySection.Read("big-red-button-hits"))
hits = hits + 1
registrySection.Write("big-red-button-hits", strI(hits))
```

