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

CSharp examples for System.Windows.Forms:Dialog

Description

Creates dialog to point to certificate file.

Demo Code


using System.Windows.Forms;
using System.IO;/*from   w  ww.j  a  v  a2 s .c  om*/
using System.Diagnostics;

public class Main{
        /// <summary>
        /// Creates dialog to point to certificate file.
        /// </summary>
        public static OpenFileDialog OpenCertificateFile(string title)
        {
            var openFile = new OpenFileDialog();
            openFile.Title = title;
            openFile.DefaultExt = ".pfx";
            openFile.Filter = "Certificate File|*.pfx|All files|*.*";

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

            return openFile;
        }
}

Related Tutorials