OpenFileDialog fileDialog= new OpenFileDialog(); fileDialog.DefaultExt = ".txt"; // Required file extension fileDialog.Filter = "Text documents (.txt)|*.txt"; // Optional file extensions fileDialog.ShowDialog();