Windows Develop Bookmark and Share   
 index > Windows Forms General > copy
 

copy

what is the command to copying (copy paste) ?

thank you
MigrationUser 1  Friday, February 14, 2003 2:45 AM
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsclipboardclasstopic.asp">Clipboard Class</a>
MigrationUser 1  Friday, February 14, 2003 10:09 AM
yes I have done

  Private Sub btnCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCopy.Click

        System.Windows.Forms.Clipboard.SetDataObject(mT.SelectedText)


    End Sub

but nothiing come out when I try to paste it somewhere
MigrationUser 1  Friday, February 14, 2003 10:12 AM
If you work with TextBoxes & RichTextBoxes you can use Copy()/Paste() methods of these classes (Copy() will place current selection into Clipboard).


Working with Clipboard class, you can verify current contents of the Clipboard as follows:

[C#]
Clipboard.SetDataObject(listBox1.SelectedItem);
// assuming you work with text
if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text))
{
    Console.WriteLine("current Clipboard contents: " + 
Clipboard.GetDataObject().GetData(DataFormats.Text).ToString());
}


[VB]
Clipboard.SetDataObject(listBox1.SelectedItem)
' assuming you work with text
If (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)) Then
    Console.WriteLine("current Clipboard contents: " & _
                 Clipboard.GetDataObject().GetData(DataFormats.Text).ToString())
End If
MigrationUser 1  Tuesday, February 25, 2003 5:16 PM
thanks !
MigrationUser 1  Sunday, August 03, 2003 2:00 PM

You can use google to search for other answers

Custom Search

More Threads

• TreeView Issues
• Convert VBA To C#
• VC# Clock
• Problem in Assign Date in MaskedtextBox!!!!
• do maths with 2 double-type numbers
• Control like in debugger (mix of TreeView and ListView)
• Force ComboBox userChange event
• Marshaling Array Of Strings
• Button Status
• transfer files between two application