LogoLogo
HomeNewsSupportVideos
  • Introduction
  • Getting Started
  • What's new in 4.0
    • Known Issues
    • .NET Core Designer
    • Managed Graphics
    • Fluent Markup
    • Markdown Support
    • Upgrade from 3.x
  • Releases
    • What's new in 4.0
    • What's new in 3.5
    • What's new in 3.2
      • View Builder
      • Validation Rules
      • Enhanced Font Support
      • Design-Time Debug
    • What's new in 3.1
    • What's new in 3.0
      • FAQs
      • Update Existing Projects
      • Multi Targeting
      • Visual Studio Designer
      • Referencing Assemblies
      • Docker Support
      • Troubleshooting
      • Deployment
    • What's new in 2.5
    • What's new in 2.2
    • What's new in 2.1
    • What's new in 2.0
    • Upgrade from 1.x
  • Getting Started
    • New Project
    • Templates
    • Troubleshooting
    • License Activation
    • FAQ
    • API
    • Hybrid
    • Deployment
    • Theme Builder
  • Concepts
    • Startup
    • Configuration
    • Load Balancing
    • Designer
    • Layouts
    • Client Profiles
    • Tab Order
    • Compression
    • Embedded Resources
    • Modal Workflow
    • Localization
    • RightToLeft
    • Background Tasks
    • Real Time Web Applications
    • JavaScript
    • JavaScript Object Model
    • Security
    • Synchronization
    • Session Management
    • Theming
    • Dependency Injection
    • Application Switches
    • Visual Studio Code
  • Controls & Components
    • General
      • Application
      • AutoSizing
      • AutoScroll
      • AutoScaling
      • Accessibility
      • Colors & Fonts
      • Embedded Tools
      • Events
      • Touch Events
      • Images
      • Labels
      • ToolTips
      • Data Binding
      • Common Properties
      • Custom Painting
      • Move & Resize
      • Drag & Drop
      • Validation
      • User Data
      • Responsive Properties
      • VB.NET Extensions
    • Common Dialogs
      • FolderBrowserDialog
      • ColorDialog
      • OpenFileDialog
      • SaveFileDialog
    • Editors
      • TextBox
        • TagTextBox
        • MaskedTextBox
        • TypedTextBox
      • DateTimePicker
      • MonthCalendar
      • TimeUpDown
      • DomainUpDown
      • NumericUpDown
      • TrackBar
    • Buttons
      • Button
      • SplitButton
      • CheckBox
      • RadioButton
    • Containers
      • Page
      • Form
      • Desktop
      • Panel
      • FlexLayoutPanel
      • FlowLayoutPanel
      • TableLayoutPanel
      • GroupBox
      • Accordion
      • TabControl
      • UserPopup
      • UserControl
      • ToolBar
      • StatusBar
      • SplitContainer
      • SlideBar
    • Lists & Grids
      • ComboBox
        • UserComboBox
        • TreeViewComboBox
        • ListViewComboBox
      • ListBox
        • CheckedListBox
      • TreeView
      • ListView
      • DataGridView
        • Column
        • TextBoxColumn
        • ButtonColumn
        • LinkColumn
        • ImageColumn
        • MaskedTextBoxColumn
        • DateTimePickerColumn
        • NumericUpDownColumn
        • CheckBoxColumn
        • ComboBoxColumn
      • DataRepeater
      • PropertyGrid
    • Extenders
      • Animation
      • ToolTip
      • ErrorProvider
      • Rotation
      • StyleSheet
      • JavaScript
    • Media
      • Audio
      • Video
      • FlashPlayer
    • Content
      • Label
      • LinkLabel
      • PictureBox
      • ScrollBars
      • Upload
      • AspNetPanel
      • ImageList
      • PdfViewer
      • ProgressBar
      • Spacer
      • Widget
      • WebBrowser
      • IFramePanel
      • HtmlPanel
      • Canvas
      • Shape
      • Line
    • Menus
      • MainMenu
      • MenuBar
      • MenuItem
      • LinkMenuItem
      • ContextMenu
    • Notifications
      • AlertBox
      • MessageBox
      • Toast
    • Other Components
      • Timer
      • BindingSource
      • BindingNavigator
      • DataSet
      • EventLog
      • MessageQueue
      • PerformanceCounter
Powered by GitBook
On this page
  • Features
  • Filtering
  • Check Existing Files
  • Help
  • How To
  • Connect to the File System
  • Customize the Appearance

Was this helpful?

Export as PDF
  1. Controls & Components
  2. Common Dialogs

SaveFileDialog

Prompts the user to select a location for saving a file on the server.

PreviousOpenFileDialogNextEditors

Last updated 2 months ago

Was this helpful?

This class can either open and overwrite an existing file or create a new file.

Most of the functionality for this class is found in the FileDialog class.

For a full list of properties, methods and events see the

Features

Filtering

The SaveFileDialog filters files shown to the user based on a given pattern. For example, the filter Image Files|*.jpg|All files|*.* will show files ending with .jpg by default. Users can modify the filter using the dropdown menu.

Check Existing Files

The SaveFileDialog validates file existence before saving to disk, helping prevent accidental file overwrites.

Help

The SaveFileDialog includes an optional "?" (Help) tool for displaying navigation assistance.

How To

Connect to the File System

Add at least one IFileSystemProvider to the Roots collection before showing the dialog:

//Using an absolute file path
SaveFileDialog filedialog = new SaveFileDialog(); 
filedialog.Roots.Add(new FileSystemProvider("C:\\", "Main_Directory"));
//Using a relative file path
SaveFileDialog filedialog = new SaveFileDialog(); 
filedialog.Roots.Add(new FileSystemProvider("./", "Main_Directory"));

Customize the Appearance

The SaveFileDialog supports customization of individual controls including textboxes and pickers.

To customize these controls:

  1. Create a class inheriting from FileDialogUI

  2. Add the custom FileDialog constructor

  3. Modify the controls as needed

public class CustomSaveFileDialogUI : FileDialogUI
{
    public CustomSaveFileDialogUI(SaveFileDialog saveFileDialog) : base(saveFileDialog)
    {
        this.HeaderBackColor = Color.DarkOrange;
        foreach (ColumnHeader col in this.listView.Columns)
        {
            col.BackColor = Color.DarkOrange;
        }
    }
}

After applying the OpenFileDialog's DialogTemplate property to the new class, the result looks like this:

For advanced customization of the SaveFileDialog using custom templates, see below.

The property returns the virtual path relative to the root. To get the physical path on the server, use .

FileDialog.FileName
FileDialog.MapPath()
API documentation.
SaveFileDialog showing image file type filtering options
SaveFileDialog showing file existence validation warning
SaveFileDialog showing help button and navigation interface
Customized SaveFileDialog with dark orange theme applied