选择文件,显示其路径在ListBox控件里

        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);
            }
        }

猜你喜欢

转载自www.cnblogs.com/wzdany/p/8855708.html