Creates dialog to point to binary file. - CSharp System.Windows.Forms

CSharp examples for System.Windows.Forms:Dialog

Description

Creates dialog to point to binary file.

Demo Code


using System.Windows.Forms;
using System.IO;//from w  w  w . ja v a 2 s. c o  m
using System.Diagnostics;

public class Main{
        /// <summary>
        /// Creates dialog to point to binary file.
        /// </summary>
        public static OpenFileDialog OpenBinaryFile(string title)
        {
            var openFile = new OpenFileDialog();
            openFile.Title = title;
            openFile.DefaultExt = ".exe";
            openFile.Filter = "VSIX Package|*.vsix;*.cab;*.msi|Executable|*.dll;*.exe;*.ocx;*.cab;*.msi|Java Package|*xpi;*.jar;*.war;*.ear|All files|*.*";

            openFile.FilterIndex = 0;
            openFile.CheckFileExists = true;
            openFile.CheckPathExists = true;

            return openFile;
        }
}

Related Tutorials