Question Saving picture from picturebox

LeisureProgrammer

New member
Joined
Sep 5, 2009
Messages
4
Programming Experience
Beginner
Hello, I was wondering why my code doesn't work :mad: - I want to save a picture from a picture box showing a webcam preview.

VB.NET:
picturebox1.Image.Save("C:\Users\MyUserName\Desktop\a.jpg")
 
Last edited:
This works even if you draw on it:
VB.NET:
Dim bmp As New Drawing.Bitmap(picturebox1.Width, picturebox1.Height)
picturebox1.DrawToBitmap(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height))
bmp.Save("yourfile.bmp")
bmp.Dispose()
:cool:
 
That's weird I use it all the time, but I draw quite a bit on mine. I have even drawn buttons for my givefeedback cursor using this???
 
I actually made it draw the picture in the picturebox - at first it wasn't actually drawing on to it, it was just streaming the video "onto" it. your code worked after that.
 
Back
Top