No announcement yet.

listView drag-n-drop cell-to-cell

  • Filter
  • Time
  • Show
Clear All
new posts

  • listView drag-n-drop cell-to-cell

    I have posted two possible solutions for drag and drop from cell to cell in a listview here . The reason this is needed is that the default behavior for listViews tends to be row-to-row. There are many custom grid controls that can accomplish this (and probably better than my code). However, many programmers may not want or not be allowed to use third-party controls. The two solutions take two different visual approaches:
    1. The first will use a custom drag image to drag the data to another cell. Upon release of the mouse button, the data will overwrite the existing data in the cell.
    2. The second example will not use drag images, but instead use highlighting to show where the data is being dragged. When the mouse button is released then a msgbox will display the cell from which the data comes and the cell to which the data is going. No data is overwritten. This example also includes a "frozen" first listview column. This was another issue I encountered with try to make a listview act like a grid control.

    As I put in the comments, much (almost all) of the code is not mine originally. I owe a big debt to many on this forum and I am very thankful to all that helped.

    Any feedback would be great. By posting here I am hoping to save another poor soul from dozens of hours of frustration with this. Thanks!
    Bill Scharf