Copy/Paste Items from listbox to any doc (Excel, Word, .txt) -- VB.NET -
Copy/Paste Items from listbox to any doc (Excel, Word, .txt) -- VB.NET -
i'm unable copy/paste items listbox document (excel, word, .txt). need select multiple items in listbox. searched there seem multiple vague answers around there. can guide me?
thanks!
all need allow selectionmode
multisimple
or multiextended
can utilize selecteditems collection re-create clipboard in keydown event of listbox
simply set
listbox1.selectionmode = selectionmode.multisimple
in form.load
event
and utilize code (note: listbox named listbox1
)
private sub listbox1_keydown(byval sender object, byval e system.windows.forms.keyeventargs) handles listbox1.keydown if e.control andalso e.keycode = keys.c dim copy_buffer new system.text.stringbuilder each item object in listbox1.selecteditems copy_buffer.appendline(item.tostring) next if copy_buffer.length > 0 clipboard.settext(copy_buffer.tostring) end if end if end sub
vb.net
Comments
Post a Comment