> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/smartadapter/wisej.ai.adapters.smarttextboxadapter.md).

# SmartTextBoxAdapter

Namespace: **Wisej.AI.Adapters**

Assembly: **Wisej.AI** (3.5.0.0)

* [SmartAdapter](/ai/components/api/smartadapter.md)
  * [SmartTextBoxAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smarttextboxadapter.md)

Enhances a TextBox control with several AI features, including suggestions, translation, and auto-correction.

{% tabs %}
{% tab title="C#" %}

```csharp
public class SmartTextBoxAdapter : SmartAdapter, IExtenderProvider
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class SmartTextBoxAdapter
    Inherits SmartAdapter
    Implements IExtenderProvider
```

{% endtab %}
{% endtabs %}

This class extends the functionality of a standard TextBox by providing AI-driven features such as text suggestions, automatic translation between specified languages, and auto-correction of text input. It uses SmartPrompt sessions to interact with AI services.

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) SmartTextBoxAdapter()

Initializes a new instanced of [SmartTextBoxAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smarttextboxadapter.md).

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) AcceptIconSource

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the source of the icon displayed when a suggestion is accepted. (Default: `null`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) ProcessingIconSource

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the source of the icon displayed during processing. (Default: `"resource.wx/Wisej.AI/Icons/processing.svg"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) SuggestionDelay

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets or sets the delay in milliseconds before suggestions are shown. (Default: `250`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) SuggestionStyle

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the CSS style applied to suggestions. (Default: `"opacity:0.4"`)

## Methods

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetEnableAutoCorrection(control)

Determines whether the auto-correction feature is enabled for the specified control.

| Parameter   | Type                                                      | Description           |
| ----------- | --------------------------------------------------------- | --------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control to check. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). True if auto-correction is enabled; otherwise, false.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the control is null.

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetEnableSuggestions(control)

Determines whether the suggestions feature is enabled for the specified control.

| Parameter   | Type                                                      | Description           |
| ----------- | --------------------------------------------------------- | --------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control to check. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). True if suggestions are enabled; otherwise, false.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the control is null.

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetEnableTranslation(control)

Determines whether the translation feature is enabled for the specified control.

| Parameter   | Type                                                      | Description           |
| ----------- | --------------------------------------------------------- | --------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control to check. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). True if translation is enabled; otherwise, false.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the control is null.

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetTranslateFromLanguage(control)

Gets the source language for the translation feature associated with the specified control.

| Parameter   | Type                                                      | Description                                             |
| ----------- | --------------------------------------------------------- | ------------------------------------------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control from which to retrieve the source language. |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The source language as a string.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the control is null.

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetTranslateToLanguage(control)

Gets the target language for the translation feature associated with the specified control.

| Parameter   | Type                                                      | Description                                             |
| ----------- | --------------------------------------------------------- | ------------------------------------------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control from which to retrieve the target language. |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The target language as a string.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the control is null.

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetUserPhrases(control)

Gets the user-provided phrases associated with the specified control.

| Parameter   | Type                                                      | Description                                          |
| ----------- | --------------------------------------------------------- | ---------------------------------------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control from which to retrieve the user phrases. |

**Returns:** [String\[\]](https://docs.microsoft.com/dotnet/api/system.string). An array of user phrases.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the control is null.

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetUserRole(control)

Gets the user role associated with the specified control.

| Parameter   | Type                                                      | Description                                       |
| ----------- | --------------------------------------------------------- | ------------------------------------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control from which to retrieve the user role. |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The user role as a string.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the control is null.

### ![](/files/KL0Ik37djZRr8a07Wopd) OnControlCreated(control)

| Parameter   | Type                                                      | Description |
| ----------- | --------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) |             |

### ![](/files/KL0Ik37djZRr8a07Wopd) OnControlDisposed(control)

| Parameter   | Type                                                      | Description |
| ----------- | --------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) |             |

### ![](/files/KL0Ik37djZRr8a07Wopd) RunAsyncCore(control)

| Parameter   | Type                                                      | Description |
| ----------- | --------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) |             |

**Returns:** [Task\<Message>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1).

### ![](/files/ptrKjmmRoQB76pvrIqh0) SetEnableAutoCorrection(control, value)

| Parameter   | Type                                                            | Description |
| ----------- | --------------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control)       |             |
| **value**   | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) |             |

### ![](/files/ptrKjmmRoQB76pvrIqh0) SetEnableSuggestions(control, value)

| Parameter   | Type                                                            | Description |
| ----------- | --------------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control)       |             |
| **value**   | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) |             |

### ![](/files/ptrKjmmRoQB76pvrIqh0) SetEnableTranslation(control, value)

| Parameter   | Type                                                            | Description |
| ----------- | --------------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control)       |             |
| **value**   | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) |             |

### ![](/files/ptrKjmmRoQB76pvrIqh0) SetTranslateFromLanguage(control, value)

Sets the source language for the translation feature associated with the specified control.

| Parameter   | Type                                                          | Description                                        |
| ----------- | ------------------------------------------------------------- | -------------------------------------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control)     | The control to associate with the source language. |
| **value**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The source language as a string.                   |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the control is null.

### ![](/files/ptrKjmmRoQB76pvrIqh0) SetTranslateToLanguage(control, value)

Sets the target language for the translation feature associated with the specified control.

| Parameter   | Type                                                          | Description                                        |
| ----------- | ------------------------------------------------------------- | -------------------------------------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control)     | The control to associate with the target language. |
| **value**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The target language as a string.                   |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the control is null.

### ![](/files/ptrKjmmRoQB76pvrIqh0) SetUserPhrases(control, phrases)

| Parameter   | Type                                                              | Description |
| ----------- | ----------------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control)         |             |
| **phrases** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) |             |

### ![](/files/ptrKjmmRoQB76pvrIqh0) SetUserRole(control, value)

| Parameter   | Type                                                          | Description |
| ----------- | ------------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control)     |             |
| **value**   | [String](https://docs.microsoft.com/dotnet/api/system.string) |             |

## Implements

| Name                                                                              | Description                                |
| --------------------------------------------------------------------------------- | ------------------------------------------ |
| [IToolProvider](/ai/components/api/smarttool/wisej.ai.smarttool.itoolprovider.md) | Represents a provider that supplies tools. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/ai/components/api/smartadapter/wisej.ai.adapters.smarttextboxadapter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
