From: Jonathan Steinberg on
I am getting the exact same exception.
I assume you probably fixed it by this point - I'd be interested in knowing
how.
I have worked around the problem by inheriting my own datagridview class,
and overriding the OnMouseDown event to swallow that error:

//Ditto -- see above error.
protected override void OnMouseDown(MouseEventArgs e)
{
try
{
base.OnMouseDown(e);

}
catch (ArgumentOutOfRangeException argEx)
{
MyApplication.LogError(argEx);
}
}

A also do the same for OnMouseMove, because of a similar exception.

Not really the best of solutions, but I don't have any better ideas, and so
far it has not caused any problems
Good Luck!


--
Jonathan Steinberg
Jefferies & Co.


"Lothar Behrens" wrote:

> Hi,
>
> I am using .NET 3.5 and object binding. A grid has one row and I add a
> new row by a separate button.
> The button_Click handler uses this code to refresh the binding:
>
> private void buttonNeuerKaeufer_Click(object sender, EventArgs
> e)
> {
> if (bindingObjektMode)
> {
> ov_mock.createRechnungsempfaenger();
> bindRechnungsempfaengerGrid(ov_mock);
> }
> }
>
> private void bindRechnungsempfaengerGrid(IObjektverkauf ov)
> {
> System.Console.WriteLine("Anzahl Rechnungsempfaenger: " +
> ov.Rechnungsempfaenger.Count());
> IEnumerable<IRechnungsempfaenger> bo =
> ov.Rechnungsempfaenger;
> if (RechnungsempfaengerDataGridView.DataSource != null)
> this.BindingContext[RechnungsempfaengerDataGridView.DataSource].SuspendBinding();
> this.RechnungsempfaengerDataGridView.DataSource = null;
> this.RechnungsempfaengerDataGridView.DataSource = bo;
>
> this.BindingContext[RechnungsempfaengerDataGridView.DataSource].ResumeBinding();
> }
>
> ....
>
> Then I see the first cell at top left selected. After that I shift +
> select with the mouse the cell under that selected.
> It is the new row. Then I get the exception and the following stack
> trace.
>
> In a simple LinqToSQL based grid I do not have this problem.
>
> What am I doing wrong?
>
> Thanks
>
> Lothar
>
> bei System.Collections.ArrayList.get_Item(Int32 index)
> bei
> System.Windows.Forms.DataGridViewColumnCollection.DisplayInOrder(Int32
> columnIndex1, Int32 columnIndex2)
> bei
> System.Windows.Forms.DataGridView.UpdateSelectedCellsBlock(Int32
> anchorColumnIndex, Int32& oldEdgeColumnIndex, Int32
> newEdgeColumnIndex, Int32 anchorRowIndex, Int32& oldEdgeRowIndex,
> Int32 newEdgeRowIndex)
> bei System.Windows.Forms.DataGridView.OnCellMouseDown(HitTestInfo
> hti, Boolean isShiftDown, Boolean isControlDown)
> bei
> System.Windows.Forms.DataGridView.OnCellMouseDown(DataGridViewCellMouseEventArgs
> e)
> bei System.Windows.Forms.DataGridView.OnMouseDown(MouseEventArgs e)
> bei System.Windows.Forms.Control.WmMouseDown(Message& m,
> MouseButtons button, Int32 clicks)
> bei System.Windows.Forms.Control.WndProc(Message& m)
> bei System.Windows.Forms.DataGridView.WndProc(Message& m)
> bei
> System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
> bei
> System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
> bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
> hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
> bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
> msg)
> bei
> System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
> dwComponentID, Int32 reason, Int32 pvLoopData)
> bei
> System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
> reason, ApplicationContext context)
> bei
> System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
> reason, ApplicationContext context)
> bei System.Windows.Forms.Application.Run(Form mainForm)
> bei Provisionsabrechnung.Program.Main() in C:\Users\l.behrens
> \Projekte\Provisionsabrechnung\Provisionsabrechnung\Program.cs:Zeile
> 20.
> .
>
 | 
Pages: 1
Prev: Checking for True
Next: DataGridView Column