Hello All

Average Vb 2005 user here!

I currently have the below code to ping the first record in my database.

I'd like to set it up so that if an IP in the Database pings, it moves on to the next record e.g NetMonListDataSet1.Addresses.Rows(2).Item(0).ToString. if it doesn't receive a response it "sendsmymail()".

I know i need a For Each loop somewhere maybe? But i can't seem to fit it in.

Any help would be most welcome.


Code:
Dim myProcess As New Process()
        myProcess.StartInfo.UseShellExecute = False
        myProcess.StartInfo.RedirectStandardOutput = True
        Try
            myProcess.StartInfo.FileName = ("ping")
            myProcess.StartInfo.Arguments = NetMonListDataSet1.Addresses.Rows(1).Item(0).ToString
            myProcess.StartInfo.CreateNoWindow = True
            myProcess.Start()
            TextBox1.Text = _
               Replace(myProcess.StandardOutput.ReadToEnd(), _
               Chr(13) & Chr(13), Chr(13))
            myProcess.WaitForExit()

            If TextBox1.Text.Contains("unreachable") Or TextBox1.Text.Contains("Timed") Then
                sendmymail()
            Else
            End If

        Catch ex As System.ComponentModel.Win32Exception
            MsgBox((ex.Message + ". Error Detected."))
        End Try

    End Sub
Thanks

Paul