選択したフォルダのパスを取得したい
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"
またはユーザーが選択したフォルダーまでの他のフォルダーのみを選択した場合です。