combobox in datagridview not working properly


I have one main form , on button click of this form I am starting backgound worker, in doWork event of it , it opens other sub form which has datagridview, datagridview contains two datagridtextbox column and one datagridCombobox column, but if I clicks on any combo box in datagridview then it shows following error message. This error sounds like need to do something different, Can you please help me on this? How can resolve this error?

DataGridView Default Error Dialog
The following exception occurred in the DataGridView:

System.Threading.ThreadStateException: 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.

at System.Windows.Forms.ComboBox.set_AutoCompleteSource(AutoCompleteSource value)

at System.Windows.Forms.DataGridViewComboBoxCell.InitializeEditingControl(Int32 rowIndex, Object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)

at System.Windows.Forms.DataGridView.InitializeEditingControlValue(DataGridViewCellStyle& dataGridViewCellStyle, DataGridViewCell dataGridViewCell)

To replace this default dialog please handle the DataError event.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!