> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DetectBlocks Method of the PageDefinition Object

This method detects blocks of the specified type within the specified region and adds them to the page definition. Please note that it does not guarantee that all the blocks will be detected correctly.

## Syntax

```vb Visual Basic .NET theme={null}
Sub DetectBlocks( _
  Region As Region, _
  AutodetectBlockTypes As IntsCollection _
)
```

```cpp C++ theme={null}
HRESULT DetectBlocks(
  IRegion*          Region,
  IIntsCollection* AutodetectBlockTypes
);
```

## Parameters

**Region**

\[in] Refers to the [**Region**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/region.md) object, which specifies the new region of the block.

**AutodetectBlockTypes**

\[in] This variable refers to a collection of block types that must be detected, represented by the constants of [**BlockTypeEnum**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/blocktypeenum.md) cast to **Integer**.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FlexiCapture SDK functions](https://docs.abbyy.com/flexi-capture/sdk/api-reference/errorcodes.md).

## See also

[**PageDefinition**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/pagedefinition.md)
