Hi Paul,
I notice that you may mistake DataRow in the Lookup table with the
DataGridViewRow in the DataGridView in the following lines of code, which
are not the same thing:
private void dataGridView1_DragDrop(object sender, DragEventArgs e)
{
...
try
{
DataRow rowToMove = this.LookupTable.Rows[row.Index];
DataRow newRow = this.LookupTable.NewRow();
newRow.ItemArray = rowToMove.ItemArray;
this.LookupTable.Rows.RemoveAt(row.Index);
this.LookupTable.Rows.InsertAt(newRow,
rowIndexOfItemUnderMouseToDrop);
dataGridView1.Rows.Insert(rowIndexOfItemUnderMouse ToDrop, rowToMove);
this.dataGridView1.Refresh();
}
....
}
You should remove the DataGridViewRow being dragged from the DataGridView
first and insert this DataGridViewRow into the new index. Modifiying the
above code as follows should solve the problem:
private void dataGridView1_DragDrop(object sender, DragEventArgs e)
{
...
try
{
this.dataGridView1.Rows.Remove(row);
this.dataGridView1.Rows.Insert(rowIndexOfItemUnder MouseToDrop, row);
}
....
}
If the problem is still not solved, please send me a simple project that
could just reproduce the problem. To get my actual email address, remove
'online' from my displayed email address.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.