This is my code for copying and pasting an object to the clipboard: private void CopyObject() { Clipboard.SetData(ClipboardDataFormats.SampleData, this.SelectedSampleObject); } private void PasteObject() { if (Clipboard.ContainsData(ClipboardDataFormats.SampleData) == true) { var sampleObject = (SampleClass)Clipboard.GetData(ClipboardDataFormats.SampleData); // exception } } I receive following exception when I call Clipboard.GetData() > System.Runtime.InteropServices.COMException Data on clipboard [...] read more
Upon running the below code, every so often I can get an error > System.Runtime.InteropServices.COMException: Data on clipboard is invalid > (Exception from HRESULT: 0x800401D3 (CLIPBRD_E_BAD_DATA)) I handle the error by the tried and true try-catch block, which is fine for my needs, but the app goes into a state [...] read more
A file (from File Explorer) has been copied using < Ctrl > < C >. The content of the file must be pasted into a RichTextBox, if the file is a picture (e.g. in JPG format) - similarly to Microsoft Word. It's already implemented and works without any problem - [...] read more