Dim graph As Graphics = Nothing
Dim frmleft As System.Drawing.Point = Me.Bounds.Location
Dim bmp As New Bitmap(Me.Bounds.Width + 8, Me.Bounds.Height + 8)
graph = Graphics.FromImage(bmp)
Dim screenx As Integer = frmleft.X
Dim screeny As Integer = frmleft.Y
graph.CopyFromScreen(screenx - 5, screeny - 5, 0, 0, bmp.Size)
PictureBox3.BackgroundImageLayout = ImageLayout.Stretch
PictureBox3.BackgroundImage = bmp
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
PictureBox3.Image.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Jpeg) 'Error Here!!!!!!'
End If
End Sub
This code is meant to screen shot and save it at the same time.The program does screen shot said form but the saving part is where the error lies.