如何用文件名填充组合框? [英] how to populate combobox with the filenames ?

查看:72
本文介绍了如何用文件名填充组合框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

晚上好..plz帮帮我..


文件夹包含扩展名为.pdf和.xml的文件集合.
如何获取.xml文件名的集合并在组合框中填充名称?

谁能在vb.net中建议代码?

Dear friends,

good evening..plz help me..


A folder contains collection of files with the extension of .pdf and .xml.
How to get collection of .xml file name and populate the names in combobox?

can anyone suggest a code in vb.net?

推荐答案

要获取文件列表,可以使用DirectoryInfo.然后遍历文件名,并将它们一个一个地添加到组合框.

To get the list of file you can use DirectoryInfo. And iterate through the file names and add them to the combobox one by one.

Dim di As New IO.DirectoryInfo("D:\MyFolder")
Dim directoryObject As IO.FileInfo() = di.GetFiles()
Dim fileInfoObject As IO.FileInfo

For Each fileInfoObject In directoryObject
    ListBox1.Items.Add(dra)
Next


这篇关于如何用文件名填充组合框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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