Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In an C# windows forms application I am using TableLayoutPanel and adding controls to it dynamically.

How can I reorder the rows using drag and drop?

Can anyone please post the code for it?

What I have tried:

I did not get any solution online
Posted
Updated 5-Jan-19 9:15am
Comments
[no name] 5-Jan-19 13:35pm    
"reordering via drag and drop" is too vague considering one usually uses a "sort" or a "mover" control, column header, etc. to reorder.
BillWoodruff 6-Jan-19 3:16am    
The TableLayoutPanel has no row or column headers. See my comments to Maciej here.
BillWoodruff 6-Jan-19 8:19am    
See my comments to Maciej's solution here. You could simulate this by some very tricky programming, but you would be better using another type of Control that exposes Row and Column objects, like a DataGridView. The TableLayoutPanel is a very simple Control.

1 solution

 
Share this answer
 
Comments
BillWoodruff 6-Jan-19 2:51am    
+3 This is helpful in the sense of information on drag/drop basics, but the TableLayoutPanel has no inherent object structures for a "row," or, "column," which includes the Controls in the cells. And, the control has no concept of a cell as object, or a selected cell, let alone a collection of selected cells.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900