将多个文件添加到列表视图中,只添加了所选的第一个文件而其他文件没有添加 [英] adding multiple files to a listview,only the first file selected is being added and the others don't

查看:56
本文介绍了将多个文件添加到列表视图中,只添加了所选的第一个文件而其他文件没有添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我有点问题

我试图将多个文件添加到listview,(我已经编写了代码来添加多个文件),但是当我添加多个文件时在列表视图上。我只看到第一个被选中。我认为问题是所有文件都属于同一个循环。无论如何我能解决这个问题吗?



提前给任何帮助的人



我用来一次添加多个文件的代码是:ofd.Multiselect = True

(ofd被定义为打开文件对话框)

hello i got a little problem
am trying to add multiple files to a listview,(i have already wrote the code to add multiple files at one),but when i add more than one files on the listview. I only see the first selected. i think the problem is that all the files fall into that same loop. is there anyway i could solve this problem?

thx in advance to any one who help

the code i used to add multiple files at once is : ofd.Multiselect = True
(ofd is define as open file dialog )

推荐答案

嘿我只是想知道是否有有什么理由你不能直接导航到你的代码中的文件所在的文件夹,并循环遍历你需要的所有文件并以这种方式添加它们?即添加以.txt或.pdf结尾的所有文件或其他...如果需要,我可以做一个快速示例。
Hey I''m just wondering if there is any reason you can''t navigate directly to the folder the files are in in you code and loop through all the files that you need and add them that way? I.e add all the files ending in .txt or .pdf or whatever... I can do a quick example if needed.


这篇关于将多个文件添加到列表视图中,只添加了所选的第一个文件而其他文件没有添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆