http://www.brangle.com/wordpress/2009/08/how-to-cutcopypaste-text-into-clipboard-using-vb-net/
ten alındı.
--------------------------------------------------------------------------------
'This code was developed by Gerardo Lopez and was downloaded from www.brangle.com
'Complete source code is available at:
'http://www.brangle.com/wordpress/2009/08/how-to-cutcopypaste-text-into-clipboard-using-vb-net/
Public Class Form1
Private Sub btnCut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCut.Click
'Checks to see if the user selected anything
If txtTextBox.SelectedText <> "" Then
'Good, the user selected something
'Copy the information to the clipbaord
Clipboard.SetText(txtTextBox.SelectedText)
'Since this is a cut command, we want to clear whatever
'text they had selected when they clicked cut
txtTextBox.SelectedText = ""
Else
'If there was no text selected, print out an error message box
MsgBox("No text is selected to cut")
End If
End Sub
Private Sub btnCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCopy.Click
'Checks to see if the user selected anything
If txtTextBox.SelectedText <> "" Then
'Copy the information to the clipboard
Clipboard.SetText(txtTextBox.SelectedText)
Else
'If no text was selected, print out an error message box
MsgBox("No text is selected to copy")
End If
End Sub
Private Sub btnPaste_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPaste.Click
'Get the data stored in the clipboard
Dim iData As IDataObject = Clipboard.GetDataObject()
'Check to see if the data is in a text format
If iData.GetDataPresent(DataFormats.Text) Then
'If it's text, then paste it into the textbox
txtTextBox.SelectedText = CType(iData.GetData(DataFormats.Text), String)
Else
'If it's not text, print a warning message
MsgBox("Data in the clipboard is not availble for entry into a textbox")
End If
End Sub
End Class--------------------------------------------------------------------------------
*
Clipboard.Clear()
*kopya hafızasını temizle
Hiç yorum yok:
Yorum Gönder