I'm looking to find a simple, concise clipboard program that can interacts with the Windows clipboard. That can pass information back and forth. Can anyone suggest anything?
Simple, concise c# clipboard program
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Dharmeshwaran SRank #819 · 2.8K reputationPosted Jun 28, 2024, 1:32 PM EDT
You Can try below C# code
using System; using System.Windows.Forms; namespace ClipboardExample { class Program { [STAThread] static void Main(string[] args) { Console.WriteLine("Clipboard Program"); Console.WriteLine("1. Copy Text to Clipboard"); Console.WriteLine("2. Paste Text from Clipboard"); Console.Write("Choose an option: "); string choice = Console.ReadLine(); switch (choice) { case "1": CopyTextToClipboard(); break; case "2": PasteTextFromClipboard(); break; default: Console.WriteLine("Invalid option."); break; } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } static void CopyTextToClipboard() { Console.Write("Enter text to copy to clipboard: "); string textToCopy = Console.ReadLine(); Clipboard.SetText(textToCopy); Console.WriteLine("Text copied to clipboard."); } static void PasteTextFromClipboard() { if (Clipboard.ContainsText()) { string clipboardText = Clipboard.GetText(); Console.WriteLine("Text from clipboard: " + clipboardText); } else { Console.WriteLine("Clipboard does not contain text."); } } } }