How to display information about SelectedFile
I am trying to get information about selected files and list their
properties (such as name and length) in a ListBox, but I couldn't figure
out how to do it. I wrote this code, but it doesn't meet my expectations.
How can I do this with a DictionaryList?
private void button1_Click(object sender, EventArgs e)
{
FileInfo fi = null;
// Dictionary<string, int> info = new Dictionary<string, int>();
openFileDialog1.Multiselect = true;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
foreach (string file in openFileDialog1.FileNames)
{
listBox1.Items.Add(fi = new FileInfo(file));
}
}
}
No comments:
Post a Comment