VB6Parse / Library / System Interaction / savepicture

VB6 Library Reference

SavePicture Statement

Saves a graphical image from a control or form to a file.

Syntax

SavePicture picture, stringexpression

Parts

Remarks

Examples

Save Form's Picture Property

' Save the persistent bitmap from a form
SavePicture Form1.Picture, "C:\Images\Form1.bmp"

Save Form's Current Appearance

' Save the current appearance of a form (including drawn graphics)
SavePicture Form1.Image, "C:\Images\FormSnapshot.bmp"

Save PictureBox Image

' Save the picture from a PictureBox control
SavePicture Picture1.Picture, "C:\Temp\MyPicture.bmp"

Save with Variable Path

Dim FileName As String
FileName = "C:\Output\Image_" & Format$(Now, "yyyymmdd_hhnnss") & ".bmp"
SavePicture Picture1.Image, FileName

Save Clipboard Image

' Save an image from the clipboard
SavePicture Clipboard.GetData(), "C:\Temp\ClipImage.bmp"

Error Handling

On Error Resume Next
SavePicture Picture1.Picture, "C:\Images\Output.bmp"
If Err.Number <> 0 Then
MsgBox "Error saving picture: " & Err.Description
End If
On Error GoTo 0

Common Errors

See Also

References

← Back to System Interaction | View all statements