473,662 Members | 2,536 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_MouseD own(object sender,
System.Windows. Forms.MouseEven tArgs e)
{
if (e.Button == MouseButtons.Le ft)
{
System.Drawing. Point point = new Point(e.X, e.Y);
DataGrid.HitTes tInfo hit= dataGridLista.H itTest(point);
if(hit.Type == DataGrid.HitTes tType.Cell)
{
this.DoDragDrop (this.PozycjaRe korduWDatasecie ,DragDropEffect s.None);

dataGridLista.C urrentCell = new DataGridCell(hi t.Row, hit.Column);
dataGridLista.S elect(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 7981
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
2751
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 and display/handle the value in the other controll. Thanks in advance.
2
2009
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 blocks of code. public class CustomDataGrid : DataGrid { public CustomDataGrid()
3
10402
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== using System; using System.Drawing; using System.Collections; using System.ComponentModel;
1
3726
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 and drop being used on different types of controls. My current task is this. I have a treeview control and a data grid control. The data grid has two fields, 'value' and 'name'. I want to be able to drag nodes from the tree view and drop them...
2
3360
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 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...
4
2421
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 web application.
1
1755
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 that i select multiple rows from the datagrid, drag them and drop them on to the combobox(dropdownlist) having an item already selected. By this way i want some kind of grouping machanism in which groups are loaded in the combobox and the data is...
1
1157
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 by pressing one of the control keys (Shift or Ctrl). What I want the user to be able to do is to select multiple rows from the DataGrid and just click-and-drag the rows somewhere. Right now, they have to check a checkbox indicating that they are...
6
4218
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 in Excel so that I can paste value in to other rows just by drag & Drop. Is it possible? Thanks.
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8764
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7367
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4180
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
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 we have to send another system
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.