1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Copy listBox? (C#)

Discussion in 'C, C++, C#' started by nuclearrap, Feb 4, 2012.

  1. nuclearrap

    nuclearrap Regular Member

    Joined:
    Apr 19, 2011
    Messages:
    354
    Likes Received:
    889
    :chicken_w

    Hey..

    how can I copy listBox1 to clipboard clicking button1. what code should I write in button1 click event
     
  2. nuclearrap

    nuclearrap Regular Member

    Joined:
    Apr 19, 2011
    Messages:
    354
    Likes Received:
    889
    ??????
     
  3. polas

    polas Newbie

    Joined:
    Jul 8, 2009
    Messages:
    11
    Likes Received:
    0
    listbox selected text

    and add this code

    Code:
    Clipboard.SetText(String.Join(Environment.NewLine, ListBox1.SelectedItems.Cast(Of String).ToArray))
     
  4. nuclearrap

    nuclearrap Regular Member

    Joined:
    Apr 19, 2011
    Messages:
    354
    Likes Received:
    889
    man, this code doesn't work