bryanche
asked on
How to save a file without using SaveFileDialog control?
Dear Experts:
I'm developing windows based application using VB.net. I would like to save an image to a specific folder without using SaveFileDialog control. I have a button to browse for image using OpenFileDialog. Once the image is selectd from some folder the image gets set to an image holder (PictureBox) the Private strImagePath will be holding the file name and path. Now I have another button that should save the image inside the folder that I want without using savefiledialog control. any help is really appreciated.
I'm developing windows based application using VB.net. I would like to save an image to a specific folder without using SaveFileDialog control. I have a button to browse for image using OpenFileDialog. Once the image is selectd from some folder the image gets set to an image holder (PictureBox) the Private strImagePath will be holding the file name and path. Now I have another button that should save the image inside the folder that I want without using savefiledialog control. any help is really appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oops, sorry. Here you go:
Dim strImagePath As String = "C:\starbucks logo.jpg"
Dim savePath As String = "c:\temp\" & System.IO.Path.GetFileName (strImageP ath)
With My.Computer.FileSystem
.WriteAllBytes(savePath, .ReadAllBytes(strImagePath ), False)
End With
MsgBox("Saved")
Dim strImagePath As String = "C:\starbucks logo.jpg"
Dim savePath As String = "c:\temp\" & System.IO.Path.GetFileName
With My.Computer.FileSystem
.WriteAllBytes(savePath, .ReadAllBytes(strImagePath
End With
MsgBox("Saved")
Dim saveDiag As New SaveFileDialog()
saveDiag.ShowDialog()
Dim sText As String = "Text to save to file"
My.Computer.FileSystem.Wri