i want to filter items from list view , i want to remove every kind of items from it but these

i just want to show these items in list

5 Years
Discussion Span
Last Post by AndreRet

What is the source of data, is it stored in a database ?

Are these samples IP addresses and port numbers ?


Will the values you showed us above be the same always, or is it returned from a database etc. How will you know what are the IP's you want to display from an entire list?


no bro it will b changed every time this is example of this
kind of items

projet have 1 list view

1 load button

1 button to remove all other items <=== (need code for this , when i press button it remove every thing but ips and ports)

these are ips and ports

Edited by honeybee2090


If the data format is consistent and is being stored in a database, you can filter it out at DB level based on the availability of colon (:) and period (.) in the string. But if it not consistent accross it will populate other data also.

for example

If you have some data like
it will also be populated in the control.

Simple because it matches the pattern even though it is not a valid Ip address and port number combination.


I would first get all the data to a list box, say something like this ...
string characters here
more strings and some string
more string and

The sub below will check if a number is returned after the "." AND ":" has been removed. if it contains only a number, it will form part of your ip address, show it in a listview...

Private Sub ShowIp()

Dim xList As Integer
Dim strIP As String

On Error Resume Next

For xList = 0 To List1.ListCount - 1
    List1.ListIndex = xList

    strIP = Replace$(List1.Text, ".", "")
    strIP = Replace$(strIP, ":", "")

    If IsNumeric(strIP) Then
        List2.AddItem List1.Text
        ''For testing purposes. You need to add the code to load the listview with the data...
        ''Not an IP address, do nothing...
    End If
Next xList
End Sub

Only a sample, you still need to adapt the code to fit your needs.


not working i try it it just make my application freez and take 100% process

application grabb data from http://www.socks5list.com/

and then show every thing in list1

i want to filter all data so list 1 show only proxies


If you remember your previous thread, we have covered everything there on how to get the data into LISTBOXES and then into LISTVIEW. Combine the 2 and it will work. I have written that code before I posted it here and it worked fine with almost no resources involved. Your app is freezing because you have a loop running as in my code but without listboxes to manipulate teh data...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.