【发布时间】:2023-03-23 12:44:01
【问题描述】:
我有以下代码将文件名从 OpenFileDialog 设置为变量:
Dim OpenDLG As New OpenFileDialog
File = OpenDLG.FileName.ToString()
Dim xPath As String = File
Dim ArrPath() = xPath.Split("\")
Dim wPathLong = ArrPath(ArrPath.Length - 1)
但现在我想为路径设置相同的内容。 So: when a file is selected and set the path (without the filename) to a variable.
我尝试修改现有代码,但无法完成。
如何修改代码,以便在选择文件并将路径(不带文件名)设置为变量时?
【问题讨论】:
标签: .net vb.net file variables path