Linux 拨号vps windows公众号手机端

vb怎么获取文件所在路径

lewis 9年前 (2016-08-31) 阅读数 9 #程序编程
文章标签 vb

在VB中,可以使用System.IO.Path类的GetDirectoryName方法来获取文件所在路径。示例如下:

Dim filePath As String = "C:\Users\Example\Documents\sample.txt"
Dim directoryPath As String = System.IO.Path.GetDirectoryName(filePath)

Console.WriteLine("File path: " & filePath)
Console.WriteLine("Directory path: " & directoryPath)

上面的代码将输出以下结果:

File path: C:\Users\Example\Documents\sample.txt
Directory path: C:\Users\Example\Documents

这样就可以获取到文件所在的路径。

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门