CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2013
    Posts
    34

    How to Remove ListView Item in VB 6.0

    Hello Guys,, I am Trying Remove Item in ListView But my Code Does not Work..
    heres my Code
    Code:
    Private Sub Command4_Click()
    Dim choice As Integer
    Dim str As String
    Dim i As Integer
    
    
    choice = MsgBox("Are you sure you want to delete this record?", vbYesNo + vbQuestion, "Confirmation")
    
    If choice = vbYes Then
    For i = ListView1.ListItems.Count To 1 Step -1
            If (ListView1.ListItems(i).Text = "") Then
                ListView1.ListItems.Remove (i)
            End If
        Next
    
        MsgBox "Record Delete", vbOKOnly, "Success"
    
    End If
    End Sub
    Help Me Guys Thanks..

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to Remove ListView Item in VB 6.0

    Create a second LV, and display the results!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: How to Remove ListView Item in VB 6.0

    What do you mean when you say it don't work? Does it crash? Does it remove something that you don't want removed? Does it burn the popcorn?
    Always use [code][/code] tags when posting code.

Tags for this Thread

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

Featured