here is you drag and drop to get you started void grdCampaigns_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DataGridView.HitTestInfo info = grdCampaigns.HitTest(e.X, e.Y); if (info.RowIndex >= 0) { DataRowView view = (DataRowView) grdCampaigns.Rows[info.RowIndex].DataBoundItem; if (view != null) grdCampaigns.DoDragDrop(view, DragDropEffects.Copy); } } } void lstCategories_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; } Collapse void lstCategories_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(DataRowView))) { // Determine which category the item was draged to Point p = lstCategories.PointToClient(new Point(e.X,e.Y)); int index = lstCategories.IndexFromPoint(p); if (index >= 0) { // Get references to the category and campaign DataRowView category = (DataRowView)lstCategories.Items[index]; DataRowView campaign = (DataRowView) e.Data.GetData(typeof(DataRowView)); // Get the old and new category ids int newID = (int)category[0]; int oldID = (int)campaign[1]; // Make sure the two do not match if (oldID != newID) { campaign.BeginEdit(); campaign[1] = newID; campaign.EndEdit(); } } } }
The Devil Lives in all of us, It's up to you to let HIM/HER out!!!!!