CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Posts
    121

    adding string to clipboard

    Hi,

    How can i add the contents of a string to windows clipboard?

    Thanks.

  2. #2
    Join Date
    May 2002
    Posts
    121
    nevermind... it's easy There is a Clipboard clas in Windows.Forms.

    from c-sharpcorner.com:

    private void CutCopyData()
    {
    Clipboard.SetDataObject(textBox1.SelectedText);
    }

    private void PasteData()
    {
    IDataObject iData = Clipboard.GetDataObject();
    //Determine whether the data is in a format you can use.
    if(iData.GetDataPresent(DataFormats.Text))
    {
    string str = (String)iData.GetData(DataFormats.Text);
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured