Results 1 to 7 of 7

Thread: [SEMI-RESOLVED] Problem with removing ListView's ColumnHeader

Threaded View

  1. #1

    Thread Starter
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    [SEMI-RESOLVED] Problem with removing ListView's ColumnHeader

    I have come accross a strange problem while removing ListView's ColumnHeader.

    Here's a sample code (works with ListView1 and Command1):
    Code:
    Option Explicit
    
    Private Sub Form_Load()
      Dim lX As Long
      Dim liItem As ListItem
      
      ListView1.View = lvwReport
      ListView1.ColumnHeaders.Add 1, , "1"
      ListView1.ColumnHeaders.Add 2, , "2"
      ListView1.ColumnHeaders.Add 3, , "3"
      
      For lX = 1 To 10
        Set liItem = ListView1.ListItems.Add
        
        liItem.Text = lX
        liItem.SubItems(1) = lX * 2
        liItem.SubItems(2) = lX * 3
        
        Set liItem = Nothing
      Next lX
    End Sub
    
    Private Sub Command1_Click()
      ListView1.ColumnHeaders.Remove 1
      ListView1.Refresh
    End Sub
    When i try to remove the 1st column, it seems to work, but, all data is "copied" to the 2nd column. I just can't get it to work correctly.

    Am i missing something?

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