代码好像没什么错误,应该是因为PictureBox1没有前景图片,即PictureBox1.Image is nothing
Try
Dim df As New SaveFileDialog()
df.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif|PNG Image|*.png"
df.FileName = String.Empty
df.ShowDialog()
If Not String.IsNullOrWhiteSpace(df.FileName) Then
Dim fs As System.IO.FileStream = DirectCast(df.OpenFile(), System.IO.FileStream)
Select Case df.FilterIndex
Case 1
PictureBox2.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg)
Exit Select
Case 2
PictureBox2.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Bmp)
Exit Select
Case 3
PictureBox2.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Gif)
Exit Select
Case 4
PictureBox2.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Png)
Exit Select
End Select
fs.Flush()
fs.Close()
Else
End If
Catch ex As Exception
End Try