> ## 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.

# TrainUserPattern Method of the Engine Object

This method allows you to perform pattern training. The method adds new pairs "a character image — the character itself" to the specified pattern.

## Syntax

### C++

```cpp theme={null}
HRESULT TrainUserPattern(
  BSTR                       FileName,
  ITrainingImagesCollection* TrainingImages,
  BSTR                       CharacterOrLigature,
  int                        Flags,
  TextTypeEnum               TextType
);
```

### C\#

```csharp theme={null}
void TrainUserPattern(
  string                   FileName,
  ITrainingImagesCollection TrainingImages,
  string                   CharacterOrLigature,
  int                      Flags,
  TextTypeEnum             TextType
);
```

### Visual Basic .NET

```vb theme={null}
Sub TrainUserPattern( _
  FileName As String, _
  TrainingImages As ITrainingImagesCollection, _
  CharacterOrLigature As String, _
  Flags As Integer, _
  TextType As TextTypeEnum _
)
```

## Parameters

FileName

\[in] This variable specifies the path to the user pattern file.

TrainingImages

\[in] This variable refers to the [TrainingImagesCollection](/fine-reader/engine/api-reference/image-related-objects/trainingimagescollection) object that stores a collection of character images.

CharacterOrLigature

\[in] This variable specifies the character which is represented by the collection of images.

Flags

\[in] This parameter contains a bitwise OR combination of the [UPTF\_](/fine-reader/engine/api-reference/enumerations/userpatternstrainingflags) prefixed flags which specifies the character attributes.

TextType

\[in] This parameter specifies the text type of the character using the [TextTypeEnum](/fine-reader/engine/api-reference/enumerations/texttypeenum) enumeration constant.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FineReader Engine functions](/fine-reader/engine/api-reference/return-codes).

## See also

[Engine](/fine-reader/engine/api-reference/engine-object-iengine-interface/supplementary-methods)

[Recognizing with Training](/fine-reader/engine/guided-tour/advanced-techniques/using-gui-elements/recognizing-with-training)
