To copy the contents of a ListBox (lstBox) to the clipboard, do this:
Code:
' Imports System.Collections
' Imports System.Windows.Forms
Dim alItems As New ArrayList
For Each item As Object In lstBox.Items
alItems.Add(item.ToString())
Next
Dim sData As String = String.Join(vbCrLf, _
CType(alItems.ToArray(GetType(String)), String()))
Clipboard.SetDataObject(sData)
You may then paste the list into Excel, Notepad, etc. You may also find the following article helpful: http://support.microsoft.com/default...b;en-us;306022
Bookmarks