New to Telerik UI for WinForms? Download free 30-day trial

Getting Started with WinForms File Dialogs

The following tutorial demonstrates how to specify a file name by using a RadSaveFileDialog, how to allow you to specify one or multiple folder names to open with the RadOpenFolderDialog and how to specify one or multiple file names to open with a RadOpenFileDialog.

  1. Add three RadLabel and three RadButton controls.

  2. Double-click each button in order to generate the Click event handler automatically.

How to use the file dialogs


    private void radButton1_Click(object sender, EventArgs e)
    {
        RadOpenFolderDialog openFolderDialog = new RadOpenFolderDialog();
        openFolderDialog.ShowDialog();
        if (openFolderDialog.OpenFolderDialogForm.DialogResult == System.Windows.Forms.DialogResult.OK)
        {
            string folderName = openFolderDialog.FileName;
            this.radLabel1.Text = folderName;
        }
    }

    private void radButton2_Click(object sender, EventArgs e)
    {
        RadOpenFileDialog openFileDialog = new RadOpenFileDialog();
        openFileDialog.ShowDialog();

        if (openFileDialog.OpenFileDialogForm.DialogResult == System.Windows.Forms.DialogResult.OK)
        {
            string fileName = openFileDialog.FileName;
            this.radLabel2.Text = fileName;
        }
    }

    private void radButton3_Click(object sender, EventArgs e)
    {
        RadSaveFileDialog saveFileDialog = new RadSaveFileDialog();
        saveFileDialog.ShowDialog();
        if (saveFileDialog.SaveFileDialogForm.DialogResult == System.Windows.Forms.DialogResult.OK)
        {
            string selectedFileName = saveFileDialog.FileName;
            this.radLabel3.Text = selectedFileName;
        }
    }

This is it! Now you can select a file name or open a folder.

Telerik UI for WinForms Learning Resources