text: This documentation is archived and is not being maintained.
  How to: Store Text in the Clipboard
  Visual Studio 2005
  The following code example uses the Clipboard object defined in the System.Windows.Forms namespace to store a string. This object provides two member functions: SetDataObject and GetDataObject. Data is stored in the Clipboard by sending any object derived from Object to SetDataObject.
  Example
  // store_clipboard.cpp // compile with: /clr #using <System.dll> #using <System.Drawing.dll> #using <System.Windows.Forms.dll> using namespace System; using namespace System::Windows::Forms; [STAThread] int main() { String^ str = "This text is copied into the Clipboard."; // Use 'true' as the second argument if // the data is to remain in the clipboard // after the program terminates. Clipboard::SetDataObject(str, true); Console::WriteLine("Added text to the Clipboard."); return 0; }
  See Also
  Show: