Hi, I'm new to VB :sweat:
Basically what I am trying to achieve is a browse button where the user is required to find a location for the file that my program will be creating. I'll give an example.
|TextBox1| (Button4)
When button4 is clicked it will open up a save file dialog. The user then finds the location of where they would like to save the file. They type a file name like "picture001" then the program automatically ads on a .jpg file format when they click Save.
Upon clicking save the file path ex. C:\picture001.jpg will be written into TextBox1. TextBox1 will not be manually editable by the user (Don't worry I think I've got that bit solved).
And of-course to show I've spent effort I'll post the sub I have so far. It creates the file you type into it only in .jpg format but then it locks up the program! :icon_cry: The code is not stable and I've tried playing around with it
Public Class OneTapWebToPicture
Private Sub Button4_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button4.Click
Dim saveFileDialog1 As New SaveFileDialog()
saveFileDialog1.Filter = "jpeg Image|*.jpg"
saveFileDialog1.Title = "Locate Where To Save File Please."
saveFileDialog1.ShowDialog()
' If the file name is not an empty string open it for saving.
If saveFileDialog1.FileName <> "" Then
' Saves the Image via a FileStream created by the OpenFile method.
Dim fs As System.IO.FileStream = CType _
(saveFileDialog1.OpenFile(), System.IO.FileStream)
' Saves the Image in the appropriate ImageFormat based upon the
' file type selected in the dialog box.
' NOTE that the FilterIndex property is one-based.
fs.Close()
End If
End Sub
Thanks!