List Of TreeNode in Clipboard ?

Posted on 2012-08-17
Last Modified: 2012-08-17
Hello EE,

I have a list(Of TreeNode) when the user press CTRL+C i would like to put all the Selectednodes of a Treeview in the ClipBoard

then if CTRL+V I would like to retrieve them

can you help? Im having difficulties
Question by:PhilippeRenaud
    LVL 85

    Accepted Solution

    Here's a quick example:
            Dim DataNameConstant As String = "MyTreeNodeList"
            Dim nodes As New List(Of TreeNode)
            nodes.Add(New TreeNode("a"))
            nodes.Add(New TreeNode("b"))
            nodes.Add(New TreeNode("c"))
            Clipboard.SetData(DataNameConstant, nodes)
            nodes = Nothing
            nodes = DirectCast(Clipboard.GetData(DataNameConstant), List(Of TreeNode))
            For Each node As TreeNode In nodes

    Open in new window

    LVL 74

    Expert Comment

    by:käµfm³d 👽
    Idle_Mind's solution is certainly what you should be doing--so long as you understand that you are going to be pasting the binary-serialized version of the List. It's not going to simply paste into Notepad as a list of items. If you want to paste this data into, say, a text editor, then you will need to format the data with newlines and place it into the clipboard as a string.
    LVL 85

    Expert Comment

    by:Mike Tomlinson I posted that I was wondering how the copy/paste is going to be utilized in the end product.
    LVL 1

    Author Comment

    Yup, I understand. Thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Suggested Solutions

    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now