Set Text to Clipboard - CSharp System.Windows.Forms

CSharp examples for System.Windows.Forms:Clipboard

Description

Set Text to Clipboard

Demo Code


using System.Windows.Forms;
using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from  w w w.ja  va  2s .c o  m

public class Main{
        public static bool SetText(string text)
        {
            try
            {
                Clipboard.SetText(text);
                return true;
            }
            catch (Exception ex)
            {
                const string msg = "Failed to copy data to the clipboard.";
                Logger.Current.Warn(msg, ex);
                return false;
            }
        }
}

Related Tutorials