Menu

display selected items from FastObjectListView

delPiero
2014-04-06
2014-04-25
  • delPiero

    delPiero - 2014-04-06

    I have this little code that works but I would like to know if there is an easier way to do this..

        Dim itmIndex As Integer = 0
        For Each aItem In lstObjectMain.SelectedObjects
            Dim selIndex As Integer = lstObjectMain.SelectedIndices.Item(itmIndex).ToString
            Debug.Print(lstObjectMain.Items(selIndex).Text)
            itmIndex += 1
        Next
    
     
  • Dreigo

    Dreigo - 2014-04-24

    First of all use For counter, not for each:

    For x=0 to lstObjectMain.SelectedObjects.Count-1...

    You can use LINQ as well:

    Dim ExportText as New List(Of String) =
    (From ActObject As Object In lstObjectMain.SelectedObjects Select ActObject.TextOrSomething).ToList

     
  • Phillip Piper

    Phillip Piper - 2014-04-25

    SelectedObjects gives you your model objects. Once you have those, you can get whatever bit of information you want to display.

    var names = this.lstObjectMain.SelectedObjects.Cast<YourModel>().Select(x => x.Name);
    Debug.WriteLine(string.Join(",", names.ToArray()));
    
     

Log in to post a comment.

MongoDB Logo MongoDB