Hey Experts,
1) I'm trying to copy the items of a ListBox to the clipboard so I can paste it into an excel document. I need the copied text to be in one row (to make it easy to paste into one column of the excel spreadsheet all in sepperate cells). The code I'm trying to use is below. I know a "ListViewItem" will not work with a listbox, but I wonder why "ListBoxItem" wouldn't be an available option? When I try to use "ListBoxItem" it says it's "not defined".
2) Additionally, If somebody knows how to directly export the text from a listbox to one column of an excel spreadsheet (each listbox item in a sepperate cell) that would be extremely helpful also.
Thanks in advance!
Pat
1) I'm trying to copy the items of a ListBox to the clipboard so I can paste it into an excel document. I need the copied text to be in one row (to make it easy to paste into one column of the excel spreadsheet all in sepperate cells). The code I'm trying to use is below. I know a "ListViewItem" will not work with a listbox, but I wonder why "ListBoxItem" wouldn't be an available option? When I try to use "ListBoxItem" it says it's "not defined".
2) Additionally, If somebody knows how to directly export the text from a listbox to one column of an excel spreadsheet (each listbox item in a sepperate cell) that would be extremely helpful also.
Thanks in advance!
Pat
VB.NET:
Dim s As String
For Each lsvrow As ListViewItem In ListBox1.SelectedItems
s &= lsvrow.Text & ControlChars.NewLine
Next
Clipboard.SetDataObject(s)