This is a migrated thread and some comments may be shown as answers.

Copy from thread

1 Answer 82 Views
GridView
This is a migrated thread and some comments may be shown as answers.
konrad
Top achievements
Rank 1
konrad asked on 18 Aug 2017, 05:11 PM

Simple code

new System.Threading.Thread(delegate ()
{               
   
  var grid = new RadGridView();
  grid.Columns.Add("column");
  grid.Rows.Add(new Object[] { "value1" });
  grid.Dock = System.Windows.Forms.DockStyle.Fill;
 
  var form = new RadForm();
  form.Controls.Add(grid);
  form.ShowDialog();
 
}).Start();

 

When i try right click + copy on cell i got error:

Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 21 Aug 2017, 07:31 AM
Hello Dominik, 

Thank you for writing.  

Note that all UI controls are not thread safe controls in the whole Windows Forms platform (not just Telerik controls, but all controls out there). Here is an article on MSDN, describing how to make thread-safe Winforms UI application. This means that any control from the Telerik UI for WinForms suite is not thread safe as well and cannot be used outside the main UI thread. 

Please refer to the following forum thread which is quite useful on this topic: http://www.telerik.com/forums/copy-to-clipboard-(different-thread) 
 
I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
konrad
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or