Skip to content

SaveFileDialog.AddExtension

property · SaveFileDialog · cAlgo.API Since 5.1

DesktopCLICloud

Gets or sets a value indicating whether a file dialog automatically adds an extension to a file name if the user omits an extension.

Environment behaviour

CLI — not supported. No dialog can be shown in the CLI: ShowDialog returns FileDialogResult.None, nothing is written and the dialog settings are only stored.

Cloud — not supported. No dialog can be shown in the cloud: ShowDialog returns FileDialogResult.None, nothing is written and the dialog settings are only stored.

Definition

public bool AddExtension {get; set;}
saveFileDialog.AddExtension: bool

Returns bool

Examples

var saveFileDialog = new SaveFileDialog { AddExtension = true, DefaultExt = "txt" };
if (saveFileDialog.ShowDialog() == FileDialogResult.OK)
    saveFileDialog.WriteToFile("Balance: " + Account.Balance);
saveFileDialog = SaveFileDialog()
saveFileDialog.AddExtension = True
saveFileDialog.DefaultExt = "txt"
if saveFileDialog.ShowDialog() == FileDialogResult.OK:
    saveFileDialog.WriteToFile(f"Balance: {api.Account.Balance}")