ShowOpen() public method

Display the Vista-style common Open dialog.
public ShowOpen ( ) : bool
return bool
        private void StyleBrowseButton_Click(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();
            dialog.Title = "Select script file";
            dialog.Filter.Add(new FilterEntry("Text file", "*.txt"));
            dialog.Filter.Add(new FilterEntry("All files", "*.*"));

            if(dialog.ShowOpen()) {
                LocationTextBox.Text = dialog.FileName;
            }
        }
Ejemplo n.º 2
0
        private void StyleBrowseButton_Click(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();
            dialog.Title = "Select style";

            if(dialog.ShowOpen()) {
                StyleTextBox.Text = dialog.FileName;
            }
        }
        private void OpenButton_Click(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();
            dialog.Title = "Select script file";
            dialog.Filter.Add(new FilterEntry("Text file", "*.txt"));
            dialog.Filter.Add(new FilterEntry("All files", "*.*"));

            if(dialog.ShowOpen()) {
                try {
                    ScriptEditor.LoadFile(dialog.FileName, RichTextBoxStreamType.PlainText);
                }
                catch {
                    MessageBox.Show("Failed to load script.", "SecureDelete", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }