【发布时间】:2011-03-01 02:42:03
【问题描述】:
当我离开数据网格的单元格时,永远不会调用 BindingSource.AddingNew。
DataGrid 将 BindingSource 作为数据源,BindingSource 又有一个“客户”的“列表”。
BindingSource 需要什么来创建新的 Customer 对象并将其添加到底层 ICustomerList ?
当然接口没有构造函数...
但我的客户对象有一个默认构造函数!
这就是我得到的例外:
System.MissingMethodException: The constcructor for the type "SAT.EnCoDe.Administration.ICustomer" was not found.
bei System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfoculture, Object[] activationAttributes)
北 System.SecurityUtils.SecureCreateInstance(类型类型,对象 [] args)
北 System.ComponentModel.BindingList1.AddNewCore()
bei System.ComponentModel.BindingList1.System.ComponentModel.IBindingList.AddNew()
北 System.Windows.Forms.BindingSource.AddNew()
北 System.Windows.Forms.CurrencyManager.AddNew()
北 DevExpress.Data.CurrencyDataController.OnCurrencyManagerAddNew()
北 DevExpress.Data.CurrencyDataController.AddNewRow()
bei DevExpress.XtraGrid.Views.Grid.GridView.OnActiveEditor_ValueModified(Object sender, EventArgs e)
北 DevExpress.XtraEditors.Repository.RepositoryItem.RaiseModified(EventArgs e)
北 DevExpress.XtraEditors.BaseEdit.OnEditValueChanging(ChangingEventArgs e)
bei DevExpress.XtraEditors.TextEdit.OnMaskBox_ValueChanged(Object sender, EventArgs e)
北 DevExpress.XtraEditors.Mask.MaskBox.RaiseEditTextChanged()
北 System.Windows.Forms.TextBoxBase.WmReflectCommand(Message&m)
北 DevExpress.XtraEditors.Mask.MaskBox.BaseWndProc(Message&m)
北 DevExpress.XtraEditors.Mask.MaskBox.WndProc(Message&m)
北 DevExpress.XtraEditors.TextBoxMaskBox.WndProc(Message& msg)
北 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
【问题讨论】:
标签: c# datagrid bindingsource