如何使用 VB6 获取目录中所有文件名的列表?
VB6中循环遍历指定文件夹目录中的所有文件并获取它们的名称的最简单方法是什么?
What is the simplest way in VB6 to loop through all the files in a specified folder directory and get their names?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
DJ 的解决方案 简单而有效,如果您需要 FileSystemObject 可以提供的更多功能(需要引用 Microsoft Scripting Runtime),只需扔掉另一个即可。
DJ's solution is simple and effective, just throwing out another one in case you need a little more functionality that the FileSystemObject can provide (requires a reference to the Microsoft Scripting Runtime).
'对于 VB6 来说非常棘手:
'只需获取保存在磁盘/项目目录中的所有项目 .frm 文件的位置
Dim CountVal As Integer
计数值 = 0
cbo.Clear
'For VB6 very Tricky:
'Simply get the location of all project .frm files saved in your disk/project directory
Dim CountVal As Integer
CountVal = 0
cbo.Clear
创建名称为 browserButton 的按钮
创建名称为 List1 的文件列表框,
双击设计中的按钮
,代码应该如下所示,
现在运行它
create button with name = browseButton
create filelistbox with name = List1
double click on button in design
and code should look like this
done now run it
您可以使用以下演示代码,
You can use the following demo code,