473,397 Members | 1,969 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,397 software developers and data experts.

Drag and Drop into a DataGrid

Hello:

I have spent two days on drag and drop now and I'm getting no where.
I am trying to drag an item from a listbox and load it into a datagrid
(actually a child of the datagrid, but I'll be happy for now to get to
the parent.) I can get the selected row of the target, but that is
not the same as dropped_on row. I've tried to get the mouse_up
event, but drag and drop seems to override the mouse_up. I've tried
the hitTest but it seems also not to be activated in the drop event.

If I can get the row index, I think I can get the values I need.

Thanks,

Ken
Nov 17 '05 #1
2 3344
Hi,
[Inline]

"Ken Loomis" <no*************@nodomain.com> wrote in message
news:h2********************************@4ax.com...
Hello:

I have spent two days on drag and drop now and I'm getting no where.
I am trying to drag an item from a listbox and load it into a datagrid
(actually a child of the datagrid, but I'll be happy for now to get to
the parent.) I can get the selected row of the target, but that is
not the same as dropped_on row. I've tried to get the mouse_up
event, but drag and drop seems to override the mouse_up. I've tried
the hitTest but it seems also not to be activated in the drop event.

If I can get the row index, I think I can get the values I need.
It should work with HitTest, did you try something like:

private void dataGrid1_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
DataGrid.HitTestInfo ht = dataGrid1.HitTest(
dataGrid1.PointToClient( new Point( e.X, e.Y ) ) );

Console.WriteLine( ht.Row );
Console.WriteLine( ht.Column );
Console.WriteLine( ht.Type );
}

HTH,
Greetings


Thanks,

Ken

Nov 17 '05 #2
On Thu, 28 Jul 2005 14:50:32 +0200, "Bart Mermuys"
<bm*************@hotmail.com> wrote:
I am trying to drag an item from a listbox and load it into a datagrid
I've tried
the hitTest but it seems not to be activated in the drop event.


It should work with HitTest, did you try something like:

private void dataGrid1_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
DataGrid.HitTestInfo ht = dataGrid1.HitTest(
dataGrid1.PointToClient( new Point( e.X, e.Y ) ) );


Bart:
I had: dataGrid1.HitTest(e.X,e.Y).

I didn't know about PointToClient.

I guess the relevant information from the Help is:
"Because the DragEventArgs.X and DragEventArgs.Y values are screen
coordinates, the example uses the PointToClient method to convert them
to client coordinates."

Thanks very much.

Ken

Nov 17 '05 #3

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

Similar topics

3
by: NewSun | last post by:
How can i drag a datarow from a datagrid to a other control? e.g. Drag a datarow from a datagrid to a TextBox,Then display one colnumn' value of the datarow . Or Drag a cell's value to a controll...
5
by: Clyde | last post by:
I am trying to implement the user feedback provided by Windows Explorer when draggng a filename from one place to another. I have the drag and drop action worked out but have had no luck in...
3
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== ...
3
by: Benny | last post by:
Hello Experts, Currently I am working on a windows-based project using asp.net with C#. One of the project tasks is to create a scheduler. For example I have two datagrids with one rows each:...
1
by: Adam Klobukowski | last post by:
Hello I'm trying to do basic drag and drop from DataGrid control. The problem is that after I start DoDragDrop, items in DataGrid will become unselected. I wish them to remian selected. I hav...
4
by: sonu | last post by:
I want to drag rows from one datagrid and drop that rows in other datagrid. when we drop rows into 2nd datagrid the rows will be deleted from first datagrid i want this functionality in...
3
by: Demetri | last post by:
If one were to develop a web server control (web control library), which enhances the datagrid by implementing a class that inherits from the DataGrid class, and give it drag and drop capability. ...
1
by: sunil | last post by:
Hi there, I am trying to implement the task in which i have a datagrid filled with data extracted from the database and a combobox in which i have populated some data. Now what i want to do is...
6
by: Neelesh2007 | last post by:
Hi to all. I m having project with VB6.0 as front End and Access-2003 as backend. In one of my code I m having Datagrid with ADODC as datasource. I want Drag & Drop Functionality in Datagrid as like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.