I’m trying to implement a Drag and Drop between two DataGridViews.
Unfortunately all the examples I can find online use ListBoxes and a method
called IndexFromPoint to determine the target location of the drop. Well,
DataGridView doesn’t have this method and I have no idea how to determine the
target index. Is there any code example or does anyone know what method to
use to get the target index?
Hello,
I found a sample about DataGridView drag and drop in codeproject, I send
you the link:
http://www.codeproject.com/csharp/DataGridView_Drag-n-Drop.asp
If this don't works, just try the cached from google link
http://72.14.203.104/search?q=cache:djRIq1QsWRUJ:www.codeproject.com/csharp/Data
GridView_Drag-n-Drop.asp+C%23+datagridview+drag+and+drop&hl=en&ct=clnk&cd=1
Good luck
Braulio

Signature
/// ------------------------------
/// Braulio Díez Colaborador DNM
///
/// http://www.dotnetmania.com
/// My Site (.net Tips): http://www.bdiez.com
/// ------------------------------
> I’m trying to implement a Drag and Drop between two DataGridViews.
> Unfortunately all the examples I can find online use ListBoxes and a method
> called IndexFromPoint to determine the target location of the drop. Well,
> DataGridView doesn’t have this method and I have no idea how to determine the
> target index. Is there any code example or does anyone know what method to
> use to get the target index?
cnickl - 27 Mar 2006 20:28 GMT
Thanks, but that was one of the first examples I looked at. The “acceptor” of
the Drop in this example is a ListBox, and they, like everywhere else, use
the IndexFromPoint method to get the index. So I can’t use it.
> Hello,
>
[quoted text clipped - 16 lines]
> > target index. Is there any code example or does anyone know what method to
> > use to get the target index?
cnickl - 28 Mar 2006 16:17 GMT
Problem solved. I used the HitTest method on the target Grid just the same
way I used it on the origin. Worked fine.
> Hello,
>
[quoted text clipped - 16 lines]
> > target index. Is there any code example or does anyone know what method to
> > use to get the target index?