Having trouble with saving my drawing in jpeg format to my computer (SaveFileDialog)

  • Thread starter Thread starter JoshuaAT123
  • Start date Start date
J

JoshuaAT123

Guest
Hello.

I am having trouble saving the drawings I create on my PictureBox1 to a file in Jpeg format to my computer.

When I run my program it pretends to save my picture but when I look where I saved it, its not there. I have a 'save picture' button on my form and the 'PictureBox1' is on my form too.


This is the code that runs the saving part.


Dim bmp As Bitmap




Private Sub SavePicture_Click(sender As Object, e As EventArgs) Handles SavePicture.Click

Dim SaveDLG As New SaveFileDialog

SaveDLG.Filter = "Bmp File (*.bmp)|*.bmp|JPEG Files (*.jpeg)|*.jpeg|All Files|*.*"

SaveDLG.Title = "Save File As"
SaveDLG.InitialDirectory = "C:\"

DialogResult = SaveDLG.ShowDialog

If DialogResult = Windows.Forms.DialogResult.OK Then

bmp = New Bitmap(PictureBox1.Width, PictureBox1.Height)


PictureBox1.DrawToBitmap(bmp, PictureBox1.ClientRectangle)

bmp.Save("Drawing.Jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)

ElseIf DialogResult = Windows.Forms.DialogResult.Cancel Then
End If



End Sub


Thank you for the help.

Continue reading...
 
Back
Top