我在FolderBrowserDialog上遇到了一些麻烦,我已经尝试了所有我能在这里找到的帖子,就我想要的而言,我几乎就在那里了。以下是我的代码:
Private Sub ButtonBrowseOutput_Click(sender As Object, e As EventArgs) Handles ButtonBrowseOutput.Click
Dim dialog = New FolderBrowserDialog()
dialog.SelectedPath = Application.StartupPath
If DialogResult.OK = dialog.ShowDialog() Then
TextBoxShowOutput.Text = dialog.ToString & "/helloforum" & ".txt"
End If
End Sub会给我类似这样的东西:
System.Windows.Forms.FolderBrowserDialog/helloforum.txt我希望它在哪里提供它,例如:
c:/users/sexyname/desktop/helloforum.txt发布于 2014-08-12 17:21:39
TextBoxShowOutput.Text = dialog.ToString & "/helloforum" & ".txt"必须是:
TextBoxShowOutput.Text = dialog.SelectedPath & "/helloforum" & ".txt"发布于 2014-08-12 17:21:12
SelectedPath -获取或设置用户选择的路径。
dialog.SelectedPath & "/helloforum.txt"发布于 2014-08-12 19:19:45
仅供您参考
Private Sub AbsolutePathOfDialogBoxes()
Dim dlgFolder = New FolderBrowserDialog
Dim dlgOpenFile = New OpenFileDialog
Dim dlgSaveFile = New SaveFileDialog
Dim absolutePath As String
'/*-----------------------------------*/'
absolutePath = dlgFolder.SelectedPath
absolutePath = dlgOpenFile.FileName
absolutePath = dlgSaveFile.FileName
'/*-----------------------------------*/'
End Sub快乐编码
https://stackoverflow.com/questions/25260409
复制相似问题