views:

92

answers:

2

I am building a WinForms application with a few custom business objects. I bind a List of a single type of object to a DataGridView with BindingList and implement IEditableObject on my object, but when I attempt to edit the values in the DataGridView I get the following exception:


The following exception occurred in the DataGridView:

System.NotImplementedException: The method or operation is not implemented. - at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component,Object value) - at System.Windows.Forms.DataGridView.DataGridViewDataConnection.PushValue(Int32 boundColumnIndex, Int32 columnIndex, Int32 rowIndex, Object value)

To replace this default dialog, please handle the DataError event.

I'm sure I'm missing something, but I don't know what it is...

Thanks in advance -

A: 

The error message tells you all you need to know - you need to handle the DataError event of your DataGridView.

The MSDN page I linked above also links to an article on Consuming Events that may be helpful as well:

To consume an event in an application, you must provide an event handler (an event-handling method) that executes program logic in response to the event and register the event handler with the event source. This process is referred to as event wiring. The visual designers for Windows Forms and Web Forms provide rapid application development (RAD) tools that simplify or hide the details of event wiring.

Andrew Hare
Thanks for your response. I should have been more clear. I am trying to figure out what is causing the error. I understand that handling the error can be customized, but I don't know why I am getting the error.
grefly
A: 

Well, apparently I'm not very observant...

The problem was that ReSharper implemented my properties with NotImplementedException, so when I edited that property through the DataGridView, it threw that Exception.

Thanks, sorry to waste your (and my!) time.

grefly