|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
VB.NET : how to fetch list box selected values (more than one) into an array
I have a VB.Net listbox on a stand alone application. Not a web app. I want to fetch the values of the selected items (multiselect extended is set on), into an array.
Please help. |
|
#2
|
|||
|
|||
|
Post your code....
|
|
#3
|
|||
|
|||
|
Quote:
You need to iterate through all of the ListItems in the collection and check the Selected property to see which ones are selected. I'm not sure why you want to put the values in an array though. |
|
#4
|
|||
|
|||
|
Dim strArrSelectedEmployees(lstEmployees.SelectedItems.Count - 1) As String
Dim intCounter As Integer Dim intSelectedCounter As Integer = 0 For intCounter = 0 To lstEmployees.Items.Count - 1 If lstEmployees.GetSelected(intCounter) Then strArrSelectedEmployees(intSelectedCounter) = lstEmployees.GetItemText(lstEmployees.Items(intCounter)) intSelectedCounter = intSelectedCounter + 1 End If Next This code works, and gets the text of the selected items into the array. But i am not able to fetch the value instead of the text. Any suggestions? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > VB.NET : how to fetch list box selected values (more than one) into an array |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|