Dim result As DialogResult = sfd.ShowDialog If result = Windows.Forms.DialogResult.OK Then If sfd.FileName <> String.Empty Then 'Set to Jpeg by default. Dim MyImageFormat As System.Drawing.Imaging.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg If sfd.FileName.ToString.ToUpper.EndsWith("JPG") Then MyImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg ElseIf sfd.FileName.ToString.ToUpper.EndsWith("BMP") Then MyImageFormat = System.Drawing.Imaging.ImageFormat.Bmp End If PictureBox1.BackgroundImage.Save(sfd.FileName, MyImageFormat) End If End If End If

Dim result As DialogResult = sfd.ShowDialog If result = Windows.Forms.DialogResult.OK Then If sfd.FileName <> String.Empty Then 'Set to Jpeg by default. Dim MyImageFormat As System.Drawing.Imaging.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg If sfd.FileName.ToString.ToUpper.EndsWith("JPG") Then MyImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg ElseIf sfd.FileName.ToString.ToUpper.EndsWith("BMP") Then MyImageFormat = System.Drawing.Imaging.ImageFormat.Bmp End If PictureBox1.Image.Save(sfd.FileName, MyImageFormat) End If End If End If