I'm not sure what to google here in order to explain what I wish to do, so I'll try here:
I'm using both OpenFileDialog
and FolderBrowserDialog
in my code for browsing for files and directories respectively.
When the dialogs open, the user gets only the option of actually browsing the tree of files/directories. However, on trees with many directories and sub directories, the users would like to also have the option to manually implicitly write (or paste) the full path the wish to go to.
How can I implement it in the code?
Here are the two functions which use the dialog boxes:
Using FolderBrowserDialog:
private void buttonAddDirectory_Click(object sender, EventArgs e)
{
this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
folderBrowserDialog.SelectedPath = "C:\\";
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
string selectedPath = folderBrowserDialog.SelectedPath;
if (!searchForFiles(selectedPath))
{
MessageBox.Show("The directory: " + selectedPath + " doesn't contain sequences.", "Error!");
return;
}
testForm.enableNumOfProcesses();
createNewCommand(runBatchScript, selectedPath, true);
}
}
Using OpenFileDialog:
private void buttonAddFile_Click(object sender, EventArgs e)
{
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
openFileDialog.InitialDirectory = "C:\\";
openFileDialog.Filter = "PMD files (*" + sequenceExtenssion + ")|*" + sequenceExtenssion + "|All files (*.*)|*.*";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string selectedFile = openFileDialog.FileName;
if (Path.GetExtension(selectedFile).CompareTo(sequenceExtenssion) != 0)
{
MessageBox.Show("The file: " + selectedFile + " is not a sequence file.", "Error!");
return;
}
createNewCommand(batchRunExe, selectedFile, false);
}
}
FolderBrowserDialog fbd = new FolderBrowserDialog();
andfbd.ShowDialog();
You could've said you've done that, shown those 2 lines,.. And say you want an input field. – Dyspepsia