displaying file order in a listbox
Posted on 2008-11-10
I am using a button and a listbox in my winform.
When I click the button, a user can select multiple files at the same time.
However, always the last selected file goes to the top of the list in the listbox.
how can I list the files in the listbox in order to be selected? For example, if I select the 3 doc files with following order:1.doc, 2.doc and 3.doc, and add all of them at the same time, the list of file should be displayed as 1.doc, 2.doc, and 3.doc from top to bottom.
The following codes are for the button.
private void button1_Click_1(object sender, EventArgs e)
dlg.Multiselect = true;
if (dlg.ShowDialog() == DialogResult.OK)
foreach (string fileName in dlg.FileNames)
textBox1.Text = fileName;