# MenuItem.Execute Method

> Executes the menu item. When the menu item opens a dialog box, the method creates and returns a DialogViewGenerator object. Otherwise it performs changes in the document.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 21.0
- **Namespace:** `TXTextControl.ServerVisualisation`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Server.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXTextControl.Server.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.Server.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl.ServerVisualization > MenuItem.Execute Method
- **293 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/menuitem/execute-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/menuitem/execute-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/menuitem/execute-method/llms-full.txt

---

### Description

Executes the menu item. When the menu item opens a dialog box, the method creates and returns a [DialogViewGenerator](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/dialogviewgenerator/llms-full.txt) object. Otherwise it performs changes in the document.

### Syntax

```csharp
public DialogViewGenerator Execute();
```

```vbnet
Public Function Execute() As DialogViewGenerator
```

### Examples

The following example uses Execute in a focused Menu Item workflow.

```csharp
var result = menuItem.Execute();
Console.WriteLine($"Execute result: {result}");
```

```vbnet
Dim result = menuItem.Execute()
Console.WriteLine($"Execute result: {result}")
```

---

## Nearby

- **Previous:** [MenuItem.Enabled Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/menuitem/enabled-property/llms-full.txt)
- **Next:** [MenuItem.Image Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/menuitem/image-property/llms-full.txt)
