我想获取选定的文件夹路径
dlgBrowse.ShowOpen
fname = dlgBrowse.FileName
dlgBrowse.Filter = "Text File (*.txt)|*.txt|Log File (*.log)|*.log||All Files (*.*)|*.*"
dlgBrowse.DialogTitle = "Open Log File"
dlgBrowse.ShowOpen
If dlgBrowse.FileName <> "" Then
txtLogFile.Text = dlgBrowse.FileName
End If
MsgBox fname
这显示了输出"C:\MRMS\Report\xyz.txt"
,但我只想要选定的文件夹路径,即如果用户只选择根(MRMS)文件夹,即"C:\MRMS"
或任何其他文件夹,直到用户选择的文件夹。