none
TreeView control - how easy is it to add/edit rows

    Question

  • Hi

    I've just got used to using the ListView but if I want to add or edit and entry in one of the rows, I have added an Add Button, Edit Button and Delete Button ok.

    I like the look of the GridView but found it too complicated to use.

    Someone advised me to use the TreeView as its a lot like Windows Explorer. In Windows Exploror, you can easily rename, and edit files(objects) without much effort.

    Can anyone advise how easy it is or not to use a treeview or listview to edit rows (similar to how its done in Windows Explorer).

    I'm just learning but finding the ListView a bit limitting for editting rows - if anyone can offer any advice.

    Cheers

    Matthew


    • Edited by jmatty2000 Tuesday, March 13, 2012 1:00 PM
    Tuesday, March 13, 2012 12:59 PM

Answers

All replies

  • None of the three are particularly difficult to use, and each has its purpose. Could you tell me exaclty what you will be listing? I could then advise which is the best control to use and give you some tips on basic use.


    James Finch (MCDST) -- Please vote as helpful if you found this post helpful, or mark as answer if it answered your question.

    Tuesday, March 13, 2012 1:12 PM
  • Hi Matthew,

    The TreeView control works extremely well as a selector control but not than nicely as a control for modifying data.
    The ListView is a bit in-between. It is nice for adding or removing, but lacking on the editing side.

    The best Control would be the DataGridView for adding, Deleting and Editing items.

    What are you getting data from and where would you like to save it?
    Once I know that I can do you some sample code.

    Regards,


    Michéle Johl

    Tuesday, March 13, 2012 1:12 PM
  • Hi Mathew,

    By GridView I hope you mean DataGridView.

    Basicly TreeView and ListView designed to simulate the look and feel of Windows Explorer.

    The function of TreeView is lot different than DataGridView. In DataGridView you have table of data but in TreeView you have a tree of data.

    Replacing of ListView by GridView from performance point of view is a must. If you want easy implementation use combination of TreeView and ListView. But If You want performance you can use combination of TreeView and DataGridView.

    Please let me know more about your desired solution maybe I can help you.

    Thanks,

    Barsham

    Tuesday, March 13, 2012 1:14 PM
  • Hi jmatty2000,

      If you really want to use Treeview insteads of other controls,it seems that the following code samples  are useful for you.

      Drag-and-drop operations in Windows Forms (CSWinFormDragAndDrop)

      http://code.msdn.microsoft.com/CSWinFormDragAndDrop-640b7c7f 

      The above code sample demonstrates how to support drag-and-drop operations in a Windows Forms application.

      Traverse TreeView in Windows Forms (CSWinFormTreeViewTraversal)

      http://code.msdn.microsoft.com/CSWinFormTreeViewTraversal-7513b7f2 

      This Windows Forms code sample demonstrates how to traverse TreeView nodes and find a specific node in TreeView.

      I hope it will solve your problem.

    Sincerely,

    Jason Wang


    orichisonic http://blog.csdn.net/orichisonic If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".


    Wednesday, March 14, 2012 4:54 AM
  • To my belief Windows Explorer uses multiple controls based on different views.

    1. List view in the detail view

    Here only the first column editing is possible.  In you case if you wanted to edit all the columns then grid view is better.



    Resolving n Evolving in C# (http://jeanpaulva.com)

    Wednesday, March 14, 2012 5:02 AM
  • Wednesday, March 14, 2012 6:02 AM