Vb.net - FolderBrowserDialog

user3857665 picture user3857665 · Aug 12, 2014 · Viewed 15.2k times · Source

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

Answer

N1C0 picture N1C0 · Aug 12, 2014
TextBoxShowOutput.Text = dialog.ToString & "/helloforum" & ".txt"

Must be:

TextBoxShowOutput.Text = dialog.SelectedPath & "/helloforum" & ".txt"