Hello there, I have this code:

If listItem.SubItems.Item(0).Text = " " Or listItem.SubItems.Item(0).Text = "" Then
   ListView1.Items.Remove(listItem)
End If

Now is it possible to make somehow to it actually count how much items got removed ? Want to show it example as:
'Clearing completed. XX Lines were removed.'

Try declaring an integer value at the class level:

Dim iCount as Integer = 0

Then increment on removal:

If listItem.SubItems.Item(0).Text = " " Or listItem.SubItems.Item(0).Text = "" Then
    ListView1.Items.Remove(listItem)
    iCount += 1
End If

Once finished print out the count:

If iCount > 0 Then
    MsgBox("Clearing completed." & iCount & " Lines were removed.")
End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.