D
Danny Macwan
Guest
i am trying to write a multi-threaded ping application. I have a listbox with a list of machine names. I want to use multiple threads to send each item to a function.
Private Function PingMe(ByVal MachineName As String)
Try
If My.Computer.Network.Ping(MachineName, 2000) Then
ListBox2.Items.Add(MachineName)
Else
ListBox3.Items.Add(MachineName)
End If
Catch ex As Exception
ListBox3.Items.Add(MachineName)
End Try
End Function
i am using a button to start the ping process
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
ListBox2.Items.Clear()
ListBox3.Items.Clear()
Dim g As Integer
For g = 0 To ListBox1.Items.Count - 1
MachineName = (ListBox1.Items(g))
PingMe(MachineName)
Dim thread As New Thread(AddressOf PingMe(MachineName))
thread.Start()
Next
End Sub
NB.com
Continue reading...
Private Function PingMe(ByVal MachineName As String)
Try
If My.Computer.Network.Ping(MachineName, 2000) Then
ListBox2.Items.Add(MachineName)
Else
ListBox3.Items.Add(MachineName)
End If
Catch ex As Exception
ListBox3.Items.Add(MachineName)
End Try
End Function
i am using a button to start the ping process
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
ListBox2.Items.Clear()
ListBox3.Items.Clear()
Dim g As Integer
For g = 0 To ListBox1.Items.Count - 1
MachineName = (ListBox1.Items(g))
PingMe(MachineName)
Dim thread As New Thread(AddressOf PingMe(MachineName))
thread.Start()
Next
End Sub
NB.com
Continue reading...