Created
          February 16, 2016 16:25 
        
      - 
      
- 
        Save oviniciusfeitosa/cb60cbe5331b7134f33f to your computer and use it in GitHub Desktop. 
    Get the SelectedValues from ListBox - VB.NET 
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Public Shared Function getSelectedValuesFromListBox(ByVal objListBox As ListBox) As String | |
| Dim listOfIndices As List(Of Integer) = objListBox.GetSelectedIndices().ToList() | |
| Dim values As String = String.Empty | |
| For Each indice As Integer In listOfIndices | |
| values &= "," & objListBox.Items(indice).Value | |
| Next indice | |
| If Not String.IsNullOrEmpty(values) Then | |
| values = values.Substring(1) | |
| End If | |
| Return values | |
| End Function | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment