Vb.net - FolderBrowserDialog
16,074
Solution 1
TextBoxShowOutput.Text = dialog.ToString & "/helloforum" & ".txt"
Must be:
TextBoxShowOutput.Text = dialog.SelectedPath & "/helloforum" & ".txt"
Solution 2
SelectedPath - Gets or sets the path selected by the user.
dialog.SelectedPath & "/helloforum.txt"
Author by
Vivek S.
Updated on August 03, 2022Comments
-
Vivek S. over 1 year
I am having some troubles with
FolderBrowserDialog
I've tried all the post I could find here and I'm almost there in terms of what I want. following is my code: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
would give me something like this:
System.Windows.Forms.FolderBrowserDialog/helloforum.txt
Where I want it to give it for example:
c:/users/sexyname/desktop/helloforum.txt
-
Vivek S. over 9 yearsdoes
helloforum.txt
always taking from yourapplication.startupPath
?? -
Admin over 9 yearsyes it does for me :)
-
Vivek S. over 9 yearsif so then you need not to use this
Dim dialog = New FolderBrowserDialog()
instead of this you could get the file name liketextBoxShowOutput.Text = Application.StartupPath & "/helloforum.txt"
-