Loop thru listview

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
4 posts Page 1 of 1
Contributors
User avatar
AnoPem
VIP - Donator
VIP - Donator
Posts: 441
Joined: Sat Jul 24, 2010 10:55 pm

Loop thru listview
AnoPem
I have this code, it checks if a proxy ip is dead or alive, but i want it to loop thru my listview to see if every ip in the list is dead or alive and then add ex, "Alive" to a subitem in the listview

my code is
Code: Select all
        Dim ip As String = TextBox3.Text
        Dim port As String = TextBox4.Text

        Button9.Enabled = True
        Button1.Enabled = False
        If TextBox2.Text > "" Then
            ElseIf TextBox2.Text < "" Then
            label3.Text = "Please wait a moment"
            Try
                Dim siteUri As New System.Uri("http://www.google.dk")
                Dim webRequest As System.Net.WebRequest = System.Net.WebRequest.Create(siteUri)
                webRequest.Proxy = New System.Net.WebProxy(ip & ":" & port)
                Dim webResponse As System.Net.WebResponse = webRequest.GetResponse()
                label3.Text = ip & ":" & port & " Is active"
            Catch ex As Exception
                label3.Text = ip & ":" & port & " Is Inactive"
            End Try

        End If
        Button1.Enabled = True
        Button9.Enabled = False
This code is inside an backgroundworker to make my program lag less
https://t.me/pump_upp
User avatar
Skillful
Skillful Coders
Skillful Coders
Posts: 969
Joined: Tue Nov 16, 2010 10:07 am

Re: Loop thru listview
Skillful
I'll need to alter the code a bit to make it loop through a listview.
PM me your TeamViewer details.
Instead of LOL use this -
LSIBMHBIWFETALOL

Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
User avatar
AnoPem
VIP - Donator
VIP - Donator
Posts: 441
Joined: Sat Jul 24, 2010 10:55 pm

Re: Loop thru listview
AnoPem
Skillful wrote:
I'll need to alter the code a bit to make it loop through a listview.
PM me your TeamViewer details.
give me a moment :)
https://t.me/pump_upp
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: Loop thru listview
M1z23R
for each lvi as listviewitem in listview1.items
if checkalive(lvi.text) then
lvi.subitems(1).text = "alive"
else
lvi.subitems(1).text = "dead"
end if
next
4 posts Page 1 of 1
Return to “Coding Help & Support”