Skip to content

FileDialogResult

enum cAlgo.API Since 5.1

DesktopCLICloud

An enumeration of the different file dialog results.

Definition

public enum FileDialogResult

Namespace: cAlgo.API · Group: Dialogs

Examples

var openFileDialog = new OpenFileDialog { Title = "Select a CSV file", Filter = "CSV files|*.csv" };
var result = openFileDialog.ShowDialog();

if (result == FileDialogResult.OK)
    Print("Selected file: {0}", openFileDialog.FileName);
else if (result == FileDialogResult.None)
    Print("File dialogs are not supported in this environment");
else
    Print("No file selected: {0}", result);
openFileDialog = OpenFileDialog()
openFileDialog.Title = "Select a CSV file"
openFileDialog.Filter = "CSV files|*.csv"
result = openFileDialog.ShowDialog()

if result == FileDialogResult.OK:
    api.Print(f"Selected file: {openFileDialog.FileName}")
elif result == getattr(FileDialogResult, "None"):
    api.Print("File dialogs are not supported in this environment")
else:
    api.Print(f"No file selected: {result}")

Values

Name Value Description
None 0 File dialog is not supported in running environment.
Cancel 1 User closed the dialog.
OK 2 User pressed Ok in dialog.
Error 3 There was an error in file dialog operation.

See also