Question Listbox blues

kiwikel

New member
Joined
May 22, 2005
Messages
2
Location
New Zealand
Programming Experience
1-3
Hi Team,

VB.Net 2008

Is there a way to select all text in a list box for copying purposes like in a richtextbox SelectAll situation? So I can hit a button to select all then copy and paste.

I have looked at many help files/pages to no avail.

Kind Regards
kiwikel
 
Do you actually need to select all items, for user or for some of your other code logic, or just copy all items? The reason I ask is because there is no built in functionality to copy a selected listbox item with ctrl+c like what is possible for selected text in textboxes.

With the SetSelected method of Listbox class you select/deselect a single item, this can be used in a loop to select all items.

If you were just copying all items text (or only the selected ones), you would also use a loop, but now the GetItemText method. All these string must be added together and then placed with Clipboard.SetText.
 
Answered : Thank you JohnH

I knew there was a way, I guess the old brain fade was setting in.

If you were just copying all items text (or only the selected ones), you would also use a loop, but now the GetItemText method. All these string must be added together and then placed with Clipboard.SetText.

Kindest Regards
Kelvin Croft
 
Back
Top