VB6: Saving A Form At The End Of Program
Hi There,
At the end of the program I want it take an image or save all the information of the form. But I would prefer an image. Probably a print screen? That's just a guess!
I know how to do the whole Form1.PrintForm1 thing but is there a way I can save the image of the form so the user can have an image of the form (which displays all the information produced by the program).
It's a cricket scoreboard by the way and the form is called Cricket_Scoreboard).
Any suggestions on what I can do? And if you could supply some code also to give me an idea?
Also where would the image save to?
Thanks Guys!
[677 byte] By [
haydo] at [2007-11-20 11:52:45]

# 1 Re: VB6: Saving A Form At The End Of Program
A simple search ( http://www.dev-archive.com/forum/search.php?) on the term "printscreen" produced 38 results. This ( http://www.dev-archive.com/forum/showthread.php?t=274576&highlight=printscreen) is one of them
# 2 Re: VB6: Saving A Form At The End Of Program
That didn't seem to help.
I found this ...
Private Sub Command1_Click()
Set Picture1.Picture = CaptureScreen()
SavePicture Picture1.Picture, "cricket.bmp"
End Sub
But it keeps saying not defined and all sorts.
What do i have to declare?
haydo at 2007-11-9 19:33:10 >

# 3 Re: VB6: Saving A Form At The End Of Program
That didn't seem to help.
So In other words, you don't want to search through the forums, we must give you everything immediately
Pardon my "rudeness", but really you have to put in some effort yourself too, else you wouldn't learn much.
# 4 Re: VB6: Saving A Form At The End Of Program
I have searched through the forums ... thats how i found the above code. I just don't know how to apply the above code to my current problem.
I'm currently doing my first project. I'm new to programming and I am trying to learn.
Sorry to upset you. I'm trying to get some advice that's all.
If you can help with my last post, please do :)
haydo at 2007-11-9 19:35:09 >

# 5 Re: VB6: Saving A Form At The End Of Program
Sorry to upset you. I'm trying to get some advice that's all.
I'm far from angry :)
OK, I'm including a sample project for you I quickly worked out. There are 3 buttons. One for capturing the screen, one for copying to the picturebox, and one for saving the file.
I added some comments as well.
Go through this code, and study it, that's all you need to do.
# 6 Re: VB6: Saving A Form At The End Of Program
OK, haydo. I've noticed a small issue with my previous sample. The problem was that the picturebox wasn't set to Autosize, so basically it only saved & showed part of the image. What I've done now was to include an invisible picturebox ( just by setting the Visible property to False, and set it to Autosize ). This invisible picturebox will hold our complete picture ( the complete form ), and this is also the picture that will be saved via the use of the commondialog control. Just to be funky, I added scrollbars to our original picturebox, so that we can scroll the entire graphic.
I hope you have fun with it