I have an application with a treeview and a datagrid, both are databound.
The treeview lists orders and below each order lists the packages in each order. The orders can be schemed based on lanes the products are being shipped on.
By default the treeview shows order number, unschemed , product.
When clicking on the order number node the datagrid view shows all the products in that order.
I want to be able to right click on an order and click on "Add Scheme" then have the program query a database table for the lane numbers and add children to the order number node named "Lane 1", "Lane 2", etc... Then I would like to be able select the products I want to go down a certain lane, drag them onto that lane, and have the program automatically modifiy the product database to indicate the new lane. When the datagrid is refreshed those orders should now show up under their proper lane and not the unschemed node.
Getting the drag an drop to work from the datagridview to the treeview is where I am really lost. Although I would appreciate input on the other steps I am really in need of help on this one part.
my datagrid is named grdCampaigns
my treeview is named lstCategories
I create a 2 global variables as such:
bool dragdrop = false;
DataGridViewSelectedRowCol
When I do the drag and drop I move the selected rows from the datagrid to the myRows variable. then in the drop I use that information to populate the treeview.
I will attach all of my code.
Open in new window