StrataFrame Forum

error with datagridview

http://forum.strataframe.net/Topic24698.aspx

By Felix M Avendano - 9/23/2009

I have a datagridview (DGV from now) bounded via a BBS to a BO and within it (the DGV) I have a cell in the form of a combobox bounded to another BO via another BBS.

If I use the native function of the DGV when tries to insert a record I get this message: (if I disable the add function of the grid, this works fine)

Last but not least, the combobox field is part of the PK, so it cannot be null.

ArgumentException
  La fila proporcionada no pertenece a este control DataGridView. (The row doesn't belongs to this DGV)
Nombre del parámetro: e.Row

Source     : System.Windows.Forms

Stack Trace:
   en System.Windows.Forms.DataGridView.OnNewRowNeeded(DataGridViewRowEventArgs e)
   en System.Windows.Forms.DataGridView.OnRowEnter(DataGridViewCell& dataGridViewCell, Int32 columnIndex, Int32 rowIndex, Boolean canCreateNewRow, Boolean validationFailureOccurred)
   en System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick)
   en System.Windows.Forms.DataGridView.OnCellMouseDown(HitTestInfo hti, Boolean isShiftDown, Boolean isControlDown)
   en System.Windows.Forms.DataGridView.OnCellMouseDown(DataGridViewCellMouseEventArgs e)
   en System.Windows.Forms.DataGridView.OnMouseDown(MouseEventArgs e)
   en System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   en System.Windows.Forms.Control.WndProc(Message& m)
   en System.Windows.Forms.DataGridView.WndProc(Message& m)
   en System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
   en System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
   en System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

By Trent L. Taylor - 9/25/2009

Please look at the Business Binding Source sample that comes with SF. If you are using a standard DGV then this sample will show you exactly what to do.
By Felix M Avendano - 9/30/2009

In the example there are no combo boxes in the DGV that gets data from another table. Without CBxs it works everything fine.