How to make a OpenFileDialog1 object return multiple paths of the selected files to a multi-line textbox?
Asked
Active
Viewed 692 times
-3
-
Start by setting the [`MultiSelect`](https://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.multiselect(v=vs.110).aspx) property to `true`, and look at the example in the docs to see how to get the names of the files selected. – D Stanley Jun 13 '16 at 14:11
1 Answers
0
I've created some code for you to use:
private void SomeMethod()
{
string[] lines = GetFileNames();
if (lines != null)
textBox1.Lines = lines;
}
private string[] GetFileNames()
{
var dialog = new OpenFileDialog()
{
Multiselect = true
};
if (dialog.ShowDialog() == DialogResult.OK)
return dialog.FileNames;
else
return null;
}
I hope it helps.

mrphil2105
- 18
- 2
- 5