I am trying to find the folder that my file is in so I can use it else where. I am using an openfiledialog. So, if the pa开发者_StackOverflow社区th of the file is "C:\test\test.text". I want to be able to get "c:\test" without the file how would i do this?
Dim path as String = System.IO.Path.GetDirectoryName(fileName)
If you have the whole path, you can use Path.GetDirectoryName:
Dim filePath As String = Path.GetDirectoryName("C:\test")
That would return C:
精彩评论