Results 1 to 10 of 10

Thread: Listbox / Listview columns

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    South Africa
    Posts
    40

    Listbox / Listview columns

    Hi,

    I need help with the Listview or Listbox controls in .Net.

    I want it to have multiple columns, and I also want the column headers to display.

    Please, any suggestions welcome!!!

  2. #2

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    South Africa
    Posts
    40

    SOLVED

    Thanks, I solved the problem.

  3. #3
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232
    Hi, can you describe how to do it? Because I have the same problem... Thx

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    South Africa
    Posts
    40
    Add a listview control to your form.

    Set the following properties:
    Columns - add all your column headers to the collection
    View - set to Details

    Good Luck!

    Linda

  5. #5
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232
    I know it :-)

    but how to insert text in the columns?

    e.g. I have 3 columns in list view, to insert text and picture to first column I used following code:

    Code:
    Dim lvi As New ListViewItem()
    
    With lvi
    .ImageIndex = 0
    .SubItems(0).Text = "first column"
    End With
    
    ListView1.Items.Add(lvi)
    but how to add text to second column of this row?

  6. #6

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    South Africa
    Posts
    40
    Try This:

    Dim objListItem As ListViewItem
    Dim objListSubItem As ListViewItem.ListViewSubItem

    objListItem = New ListViewItem()
    objListSubItem = New ListViewItem.ListViewSubItem()

    objListItem.Text = "A"
    objListSubItem.Text = "B"
    objListItem.SubItems.Add(objListSubItem)
    objListSubItem = New ListViewItem.ListViewSubItem()
    objListSubItem.Text = "C"
    objListItem.SubItems.Add(objListSubItem)

    lstTest.Items.Add(objListItem)

    Good Luck!
    Linda

  7. #7
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Question

    yeeeee, very sophisticated (but works :-)

    do you know also how to get itemid when user clicks to listview (e.g. listview1_doubleclick event) and how to order columns (sorting property) when user clicks to column header? Thanks again.

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    South Africa
    Posts
    40
    no, unfortunately not. But, please let me know once you've figured it out (if you don't mind!)

  9. #9
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232
    OK,

    currently I have found how to sort first column only, but this statement doesn't work for all other columns...

  10. #10
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232
    Are you talking about the VB6...
    this board is for .NET only

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width