get last copied text and image

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
2 posts Page 1 of 1
Contributors
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

get last copied text and image
Shim
hello guys

this is a small snippet that will display the last copied text in the richtextbox
Code: Select all
Public Class Form1
    'shimthecoder
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            If My.Computer.Clipboard.ContainsText() Then
                Dim ClipText As String
                ClipText = My.Computer.Clipboard.GetText
                RichTextBox1.Text = (ClipText)
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class

this will display the last copied image in picbox
Code: Select all
Public Class Form1
    'shimthecoder
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            If My.Computer.Clipboard.ContainsImage() Then
                Dim ClipboardImage As System.Drawing.Image
                ClipboardImage = My.Computer.Clipboard.GetImage
                PictureBox1.BackgroundImage = ClipboardImage
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class

thanks
Find my programs on Softpedia
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Re: get last copied text and image
smashapps
This is a simple tutorial but useful, thanks for sharing!
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
2 posts Page 1 of 1
Return to “Tutorials”