While I was in the middle of making a paint drawing program I had found out a very easy way to take a screenshot and display it in a picturebox or form!
Here is the code below:
Backs up your clipboard because the image will be put there.
This will automatically press the key that you have chosen. In our case it would be the Print Screen key. This will capture the picture.Code:Dim BackUpClipboard As String = My.Computer.Clipboard.GetText
PUT IMAGE INTO PICTUREBOX:Code:SendKeys.Send("{PRTSC}")
What this is doing is setting your picturebox image with the captured image which is located in your clipboard which is why we had to back it up.
Code:PictureBox1.Image = My.Computer.Clipboard.GetImage
PUT IMAGE INTO FORM:
What this is doing is setting your forms background image with the captured image which is located in your clipboard which is why we had to back it up.
Code:Me.BackgroundImage = My.Computer.Clipboard.GetImage
This will restore your clipboard to what it was before.
Code:My.Computer.Clipboard.SetText(BackUpClipboard)
Note: Backing up is not needed!
Feel free to comment!![]()


Reply With Quote