Drag and Drop with DataGridView

G

Guest

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?
 
G

Guest

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...datagridview+drag+and+drop&hl=en&ct=clnk&cd=1

Good luck
Braulio

--
/// ------------------------------
/// Braulio Díez Colaborador DNM
///
/// http://www.dotnetmania.com
/// My Site (.net Tips): http://www.bdiez.com
/// ------------------------------
 
G

Guest

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.
 
G

Guest

Problem solved. I used the HitTest method on the target Grid just the same
way I used it on the origin. Worked fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top