locked
System.NotSupportedException after BindingSource.AddNew() RRS feed

  • Question

  • Even though I previously set my BindingSource object to AllowNew = True,
    whenever I call BindingSource.AddNew() after that I get the exception below.

    Does anyone know why this might be happening?
    Thanks

    System.NotSupportedException was unhandled by user code
      Message="Specified method is not supported."
      Source="System.Data"
      StackTrace:
           at
    System.Data.DataViewManager.System.ComponentModel.IBindingList.AddNew()
           at System.Windows.Forms.BindingSource.AddNew()
           at WinPresentationLayer.ProjectForm.SetDataBindings() in
    D:\WinPresentationLayer\Views\ProjectForm.vb:line 64
           at WinPresentationLayer.ProjectForm.ProjectForm_Load(Object sender,
    EventArgs e) in D:\WinPresentationLayer\Views\ProjectForm.vb:line 28
           at System.EventHandler.Invoke(Object sender, EventArgs e)
           at System.Windows.Forms.Form.OnLoad(EventArgs e)
           at System.Windows.Forms.Form.OnCreateControl()
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.Control.CreateControl()
           at System.Windows.Forms.Control.WmShowWindow(Message& m)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           at System.Windows.Forms.ContainerControl.WndProc(Message& m)
           at System.Windows.Forms.Form.WmShowWindow(Message& m)
           at System.Windows.Forms.Form.WndProc(Message& m)
           at
    System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
    IntPtr wparam, IntPtr lparam)

     

    Saturday, May 20, 2006 5:00 PM

Answers

  • I discovered that the exception was raised because I had not yet assigned a value to the BindingSource.DataMember property.

    I had intended/hoped that AddNew() would add a new row to each DataTable in the DataSet but obviously it only acts upon the assigned DataMember.

    Wednesday, May 24, 2006 6:07 PM

All replies

  • I still have not solved this.

    Anyone know the answer? Is more detail required?

    Thanks.
    Mark

    Tuesday, May 23, 2006 8:53 PM
  • I discovered that the exception was raised because I had not yet assigned a value to the BindingSource.DataMember property.

    I had intended/hoped that AddNew() would add a new row to each DataTable in the DataSet but obviously it only acts upon the assigned DataMember.

    Wednesday, May 24, 2006 6:07 PM
  •  

    Mark,

     

    I have been fighting with the exact same exception for a few days now and guess I was using the wrong sequence of words when searching for help, as I only saw your post of 2006 now! Anyway, can you tell me where/how you assigned the value to the BindingSource.DataMember? I am using an unbound form, adding my bindings at runtime and using a SQLDataReader to populate my dataset, which is the datasource for my bindingsource, which in turn is the binding source for my navigator (hope that made sense!).

     

    Regards,

     

    Liz

    Thursday, November 15, 2007 7:00 PM