Select the file and display its path in the ListBox control

 

        private void btnSelect_Click(object sender, EventArgs e)
        {
            lbxFiles.Items.Clear();
            OpenFileDialog file = new OpenFileDialog();
            file.Multiselect = true;//允许选择多个文件
            if (file.ShowDialog() == DialogResult.OK)
            {
                lbxFiles.Items.AddRange(file.FileNames);
            }
        }

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324436193&siteId=291194637