473,326 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Drag Drop Onto DataGridView

I have a Windows Forms application where I need to be able to drag and
then drop onto a datagridview control. I already have the code
necessary to make the drag part work. I am having problems, however,
when I attempt to drop onto a cell in the datagridview. So far
I have done the following with the datagridview control...

1. I set "AllowDrop" to true.

2. In the DragEnter event I put this...

if (e.Data.GetDataPresent(DataFormats.Text)) { e.Effect =
DragDropEffects.Copy; }
else { e.Effect = DragDropEffects.None; }

3. In the DragDrop event I put this...

this.dgvMyGrid.CurrentCell.Value =
e.Data.GetData(DataFormats.Text).ToString();

The code already works...well sort of. When I drag and drop, the mouse
changes to show there is data, and then it gets put into the selected
cell when I drop. BUT, I can't have the user to manually "select" the
cell prior to each drag and drop operation. That doesn't make sense.
You see, I need for the drop to occur in whatever cell I release over,
instead of whatever cell was already selected. In effect, the cell
should "auto select" whenever the drop occurs on it.

How do I do that?

Jul 12 '06 #1
0 2155

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Patrick Kramer | last post by:
I'm building a file format converter for someone who at best takes more than his fair share of IT helpdesk hours :D So I want to make it as simple as possible. What I want it to do is, run: ...
0
by: Lauren Quantrell | last post by:
I'm trying to drop a file from Windows Explorer (or desktop, etc.) onto a field in Access2K and capture the full file path. I found an posting below that says this is possible but I cannot...
1
by: Greg | last post by:
I have a custom control called PageBanner which is compiled into a DLL and then put into the toolbox. It shows like I would expect it to in the toolbox, and I can drag and drop it onto a form. ...
9
by: Mark | last post by:
hi... i have a program that opens a couple files and performs some operations on them. i wanted to modify my program so that if you drag and drop a file onto the exe via windows, it will open...
0
by: statlerw | last post by:
I have successfully implemented drag and drop in my application to allow the reordering of columns by dragging and dropping them in the same datagridvire (Net 2.0). If i take it relatively...
0
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using vS2005 and .net 2.0. for a Windows application. I'm implementing a Drag and Drop between 2 DataGridView controls. It's working fine with just one item being drag and drop. I want...
0
by: =?Utf-8?B?VGVycnk=?= | last post by:
Hello All... I need a little help; I have two datagridview controls side by side. I need to allow the user to drag and drop rows with in the same grid, but I also need the second datagridview to...
3
by: Sizer | last post by:
I have several python utils that look at sys.argv to get a list of filenames to process and mangle the files in various ways. If I have a bar.bat file in Windows XP then I can just drag foo.avi...
0
by: munishbatra2002 | last post by:
hi all, we are using a gridview and a treeview control ... we want to drag a row from gridview control and drop it onto treeview control on a web page... we are using C# ASP.NET ... can anyone...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.