List view control with multiple columns

How can we tell out list view control [that has multiple coulms in the columns collection] to add a specific list view item in 1st, 2nd or say nth column,

I know to see columns we add in the columns collection [@ design time] we have to set the view property of the list view to DETAILS [from the combo], but how we can programatically add text in our desired column

in other words how can we manage what item is gonna added in what column




Answer this question

List view control with multiple columns

  • Frens

    Me.ListView1.View = View.Details

    Me.ListView1.Columns.Add("C1")

    Me.ListView1.Columns.Add("C2")

    Me.ListView1.Columns.Add("C3")

    Dim I1 As ListViewItem = Me.ListView1.Items.Add("Item1 column 1")

    I1.SubItems.Add("Item1 Column2")

    I1.SubItems.Add("item1 Column3")

    Me.ListView1.Items.Add("Item2 column 1")



  • Rtalan

    does this help

     



    //add a couple of column
    Me.theListView.Columns.Add("FirstColumn")
    Me.theListView.Columns.Add("SecondColumn")
     
    //add items to the column
    Me.theListView.Columns("FirstColumn").ListView.Items.Add("MyItem")
    Me.theListView.Columns("SecondColumn").ListView.Items.Add("Another Item")

     

     

    this will add 2 columns and add an item to each column. To access the column, go through the index of the column:

     

    Me.theListView.Columns(ColumnIndexOrName).ListViewItems.......

     

     



  • List view control with multiple columns