Dim
创新互联是一家专业提供天峻企业网站建设,专注与网站建设、网站制作、H5页面制作、小程序制作等业务。10年已为天峻众多企业、政府机构等服务。创新互联专业的建站公司优惠进行中。
dir
As
New
IO.DirectoryInfo("C:\TDDownload")
//
目录下就一个文件夹
If
dir.GetDirectories.Length
Then
MessageBox.Show(dir.GetDirectories.GetValue(0).ToString())
End
If
//
目录下多个文件夹
'For
Each
d
As
IO.DirectoryInfo
In
dir.GetDirectories
'
MessageBox.Show(d.FullName)
'Next
命名空间:System.Windows.Forms
Application.StartupPath 属性(返回String)
获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。
Application.ExecutablePath 属性(返回String)
获取启动了应用程序的可执行文件的路径,包括可执行文件的名称。
Vb.net获取某个目录下文件夹名称(不包含隐藏文件夹)实现代码如下:
Dim dir As New DirectoryInfo("D:\")
For Each d As DirectoryInfo In dir.GetDirectories
ComboBox1.Items.Add(d.Name)
Next
dim finfo as new fileinfo(d.name)
if (finfo.attributes and FileAttributes.Hidden)FileAttributes.Hidden then
ComboBox1.Items.Add(d.Name)
end if
用Io.Directory.GetFiles("D:\")函数获得一个存放D盘目录文件的字符串数组
代码:
For Each item As String In IO.Directory.GetFiles("D:\")
ListBox1.Items.Add(item)
Next
运行之后,ListBox1里就会有这些文件
System.Environment.CurrentDirectory
这才是vb.net的获取程序运行路径的方法
Server.MapPath("~") "\" "Web.config"Server.MapPath("~") 是取当前目录上一级的路径Server.MapPath(".") 是取当前目录的路径
网页标题:vb.net获得目录 vbnet打开指定目录下的文件
链接分享:https://www.cdcxhl.com/article38/dosdppp.html
成都网站建设公司_创新互联,为您提供企业网站制作、全网营销推广、搜索引擎优化、Google、定制开发、网页设计公司
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联