473,506 Members | 17,176 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid Drag'n drop

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 such code:

private void dataGrid_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
System.Drawing.Point point = new Point(e.X, e.Y);
DataGrid.HitTestInfo hit= dataGridLista.HitTest(point);
if(hit.Type == DataGrid.HitTestType.Cell)
{
this.DoDragDrop(this.PozycjaRekorduWDatasecie,Drag DropEffects.None);

dataGridLista.CurrentCell = new DataGridCell(hit.Row, hit.Column);
dataGridLista.Select(hit.Row);
}
}
}

If I comment uot yhis.DoDragDrop, the item will be selected. Otherwise
it is on.

Note that I have to select whole row, not just one cell.

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl
Nov 16 '05 #1
1 7971
I was able to fix it by using MouseMove event instead of MouseDown.

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl
Nov 16 '05 #2

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

Similar topics

3
2739
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...
2
2004
by: HKM | last post by:
Hello ! I have extended DataGrid Control as per my requirements. My questions is how to add this Custom Data Grid to the Form (that I want this customized grid to appear). Following are the...
3
10390
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== ...
1
3719
by: Torre Quinn | last post by:
Does anyone have any good sites or resources dealing with adding drag and drop functionality to a set of controls on a form? I'd like to try to get several examples of varied applications of drag...
2
3352
by: Ken Loomis | last post by:
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...
4
2416
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...
1
1746
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...
1
1150
by: Kyjan | last post by:
Greetings to all! Whenever you click the mouse button (left) in the DataGrid, all selected rows are instantly unselected and the row you clicked on is selected. The only way to prevent this is...
6
4203
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
7218
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
7103
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
7307
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
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5614
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,...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.