[RESOLVED] SaveFileDialog location in textbox?
Hey simple question but I don't know much about the savefiledialog component. I know I can bring up the dialog with savefiledialog.showdialog but what I want to do is allow the user to browse to a location to save the file, press okay then that destination be placed in a textbox on the form? Any help? Thanks!
Re: SaveFileDialog location in textbox?
Try this (Amend as Applicable)
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
saveFileDialog1.Filter = "JPeg Image|*.jpg"
saveFileDialog1.Title = "Save an Image File"
saveFileDialog1.ShowDialog()
' If the file name is not an empty string open it for saving.
If saveFileDialog1.Filename <> "" Then
Textbox1.Text = saveFileDialog1.Filename
End If
End Sub
Sid
Re: SaveFileDialog location in textbox?
Also I have not written the code to save.... That you will have to insert separately...
Sid
Re: SaveFileDialog location in textbox?
Sorry not sure why I was using a save file dialog, what I want to do is allow the user to browse to a folder and select that folder and have the path placed in a textbox?
Re: SaveFileDialog location in textbox?
Never mind!! Just changed the .filename to .selectedpath and all works perfectly!! Thanks for your help!
Re: [RESOLVED] SaveFileDialog location in textbox?
In that case try this...
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
Dim FolderBrowserDialog1 As New FolderBrowserDialog
With FolderBrowserDialog1
.SelectedPath = "c:\"
.Description = "Select the source directory"
If .ShowDialog = DialogResult.OK Then
Textbox1.Text = (.SelectedPath)
End If
End With
End Sub
Sid