-
October 17th, 2013, 03:32 AM
#1
Select Items In Listbox and add them to string
Hi Guys,
I need some help with a little code i am working in VB 2010 and making a program for work, i am almost finished but i am having trouble getting all the items that are in a list box and adding them to a string. So it needs to select all items in that list box i have been able to get the highlighted item and add it to a string but cannot get ever item to add or even highlight to that string.
Any help would be greatly appreciated.
Thanks in advance.
-
October 17th, 2013, 09:15 AM
#2
Re: Select Items In Listbox and add them to string
[ Moved ]
perhaps something like this might help :
Code:
Dim SelItems(ListBox1.SelectedItems.Count - 1) As String 'Create Array With Selected Items
ListBox1.SelectedItems.CopyTo(SelItems, 0) 'Copy All Selected Items To Array
Dim AllItemsInOneString As String = String.Join(" ", SelItems) 'Join All Array Items To One String Separated By A Space
Oh, and welcome to the forums!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|