I am having an exception when running the function PingTest() in terms of the array I'm using. I'm not entirely sure how this is happening. Here is all the code.
Code:Dim pingTo As String = "www.google.com" Dim amountOfTests As Integer = 10 Dim testIterations(amountOfTests - 1) As Integer Public Function AverageOfTests() As Boolean Dim average As Double For count As Integer = 0 To amountOfTests average = average + testIterations(count) count += 1 Next txtResults.Text += average Return True End Function Public Function PingTest() As Boolean For count As Integer = testIterations(count) To amountOfTests count += 1 Dim ping As New System.Net.NetworkInformation.Ping Dim ms = ping.Send(pingTo).RoundtripTime() txtResults.Text += System.Environment.NewLine txtResults.Text += "pinged (" & pingTo & ") at " & ms & "." testIterations(count) = CInt(ms) Next AverageOfTests() Return True End Function Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click txtResults.Clear() PingTest() End Sub




Reply With Quote
