I use OpenFileDialog class, to open and display a filename chosen.
List<string> paths;
private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
{
label1.Text = "Now you can save the file paths or remove them from the list above";
paths.Add(openFileDialog1.FileName);
listBox1.DataSource=paths ;//Only one file is displayed in the listbox
Refresh();
}
I want the user to choose several files and display all the files that he chose in the listbox that i have. The problem is that only one file path is displayed each time. What is funny, is that i thoguht that whenever i use pahts.Add,,new filename is added, but in reality it isnt so!?!
You have to set
Multiselectin your file dialog to true and then use theFileNamesproperty: