Copy or Paste Text to Clipboard in C#

This C# tutorial is explaining about how to Paste text or data from Clipboard & How to copy text or data to Clipboard. You can also check the active data or text on clipboard in this Csharp example program. Here is the source code with explanation of it.

Copying Text to Clipboard in C#

First we will discuss about Copying to clipboard. This example simply builds an array of string names and places it in the clipboard, setting its data type to FileDrop in the Event. Below is a sample code of it.

As you can check the comments of above code. It first populate a List with Files Name from any directory which you can set as your need. Then it Clear the already copied data from clipboard & then it Copies this List to Clipboard.

Pasting Text from Clipboard in C#

Now we are discussing this below example of How to Paste Data or Text from Clipboard to your selected Control. Lets have a look at its source code.

In above code we simply creates an array of string which we filled from array of Text or data of Clipboard by using FileDrop method. In next step we just populate our selected control from the string array. In my case I populate a listbox here.

3 thoughts on “Copy or Paste Text to Clipboard in C#”

  1. I see your site is similar to my page. Do you allow guest posting?
    I can write high quality & unique content for you.
    Let me know if you are interested.

Comments are closed.