---
id: "M:cAlgo.API.OpenFileDialog.ShowDialog"
kind: "method"
type: "T:cAlgo.API.OpenFileDialog"
url: "https://help.ctrader.com/ctrader-algo/references/Dialogs/OpenFileDialog/ShowDialog/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# OpenFileDialog.ShowDialog

Member of [OpenFileDialog](https://help.ctrader.com/ctrader-algo/references/Dialogs/OpenFileDialog/index.md).

## ShowDialog()

Shows a file dialog, with the owner as the main Window

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: No dialog is shown. Returns FileDialogResult.None; FileName and FileNames are unchanged.
- Cloud: No dialog is shown. Returns FileDialogResult.None; FileName and FileNames are unchanged.

C#:

```csharp
public FileDialogResult ShowDialog()
```

Python:

```python
openFileDialog.ShowDialog() -> FileDialogResult
```

### Returns

`FileDialogResult` — 

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
var openFileDialog = new OpenFileDialog { Filter = "CSV files (*.csv)|*.csv" };
var result = openFileDialog.ShowDialog();
if (result == FileDialogResult.OK)
    Print("Importing {0}", openFileDialog.FileName);
else
    Print("Dialog result: {0}", result);
```

Python:

```python
openFileDialog = OpenFileDialog()
openFileDialog.Filter = "CSV files (*.csv)|*.csv"
result = openFileDialog.ShowDialog()
if result == FileDialogResult.OK:
    api.Print(f"Importing {openFileDialog.FileName}")
else:
    api.Print(f"Dialog result: {result}")
```

## ShowDialog(Window owner)

Shows a file dialog, with the passed owner window.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: No dialog is shown. Returns FileDialogResult.None; FileName and FileNames are unchanged.
- Cloud: No dialog is shown. Returns FileDialogResult.None; FileName and FileNames are unchanged.

C#:

```csharp
public FileDialogResult ShowDialog(Window owner)
```

Python:

```python
openFileDialog.ShowDialog(owner: Window) -> FileDialogResult
```

### Parameters

- `owner` (`Window`, Python `Window`): The window that owns the file dialog.

### Returns

`FileDialogResult` — 

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
var window = new Window { Title = "Import", Width = 300, Height = 150 };
var browseButton = new Button { Text = "Browse" };
browseButton.Click += args =>
{
    var openFileDialog = new OpenFileDialog();
    if (openFileDialog.ShowDialog(window) == FileDialogResult.OK)
        Print("File: {0}", openFileDialog.FileName);
};
window.Child = browseButton;
window.Show();
```

Python:

```python
window = Window()
window.Title = "Import"
window.Width = 300
window.Height = 150
window.Show()
openFileDialog = OpenFileDialog()
if openFileDialog.ShowDialog(window) == FileDialogResult.OK:
    api.Print(f"File: {openFileDialog.FileName}")
```

