Here is a bit of code to help you:
Private Sub mnuSaveAs_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuSaveAs.Click
Dim img2 As Image
With sdlgImage 'sdlgImage is the name I gave the SaveFileDialog1 control
..InitialDirectory = "C:\"
..FileName = "myimage"
..Filter = "Bitmap (*.bmp)|*.bmp|GIF (*.gif)|*.gif|JPEG (*.jpg)|*.jpg|TIF
(*.tif)|*.tif|PNG (*.png) |*.png"
..FilterIndex = 1
End With
If sdlgImage.ShowDialog() = DialogResult.OK Then
Dim strMsg As String
PictureBox1.Image.Save(sdlgImage.FileName, GetImageFormat())
strMsg = "Image successfully saved to " & sdlgImage.FileName
MessageBox.Show("Image successfully saved to " & _
sdlgImage.FileName, Me.Text, _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Put this in the Click event of the button or Menu Item you are using to save
your image and you should be ok.
You also want to be able to get the image format of the image you are saving
here is how:
Private Function GetImageFormat() As ImageFormat
Select Case sdlgImage.FilterIndex
Case 1
Return ImageFormat.Bmp
Case 2
Return ImageFormat.Gif
Case 3
Return ImageFormat.Jpeg
Case 4
Return ImageFormat.Tiff
Case Else
Return ImageFormat.Png
End Select
End Function
That should get you going.
james
moondaddy said:
I tried that but it seemed to have no effect. Perhaps my problem is related
to my other post titled "Trouble setting properties in saveFileDialog". Any
ideas why it wouldn't open showing these property settings?