joshuadeboer
Well-known member
Hi, i'm making a network monitoring program, and the way it works is after five ping-fails, it sends an email, but i cant get it to work! the test email works fine, so its not the email code.
I there something i'm doing wrong
VB.NET:
Dim s As Short
Dim newstr(4) As String
Dim I As Integer
Dim name As String
Dim MS As String
Dim Errors As String
Dim IP As String
Dim errorState As String
Dim ItemCount As Integer
Dim Count As Integer
ItemCount = lstMain.Items.Count
For I = 0 To ItemCount - 1
For s = 0 To 4
newstr(s) = listview1.Items.Item(I).SubItems(s).Text
Next
Count = listview1.Items.Item(I).Index
name = newstr(0)
IP = newstr(3)
If DoPing(IP) = True Then
newstr(1) = (GetRep(IP))
If newstr(4) = 6 Then
SendEmail()
newstr(4) = 1
Else
newstr(4) = 1
End If
name = newstr(0)
IP = newstr(3)
MS = newstr(1)
Errors = newstr(2)
errorState = newstr(4)
listview1.Items.RemoveAt(Count)
Dim Ping As New ListViewItem
Ping.Name = name
Ping.Text = name
Ping.BackColor = Color.WhiteSmoke
Ping.SubItems.Add(MS)
Ping.SubItems.Add(Errors)
Ping.SubItems.Add(IP)
Ping.SubItems.Add(errorState)
listview1.Items.Insert(Count, Ping)
listview1.Refresh()
Else
newstr(2) = newstr(2) + 1
newstr(1) = "<error>"
If newstr(4) = 5 Then
SendEmail()
newstr(4) = newstr(4) + 1
Else
If Not newstr(4) = 6 Then
newstr(4) = newstr(4) + 1
End If
End If
name = newstr(0)
IP = newstr(3)
MS = newstr(1)
Errors = newstr(2)
errorState = newstr(4)
Dim Ping As New ListViewItem
listview1.Items.RemoveAt(Count)
Ping.Name = name
Ping.Text = name
Ping.BackColor = Color.Red
Ping.SubItems.Add(MS)
Ping.SubItems.Add(Errors)
Ping.SubItems.Add(IP)
Ping.SubItems.Add(errorState)
listview1.Items.Insert(Count, Ping)
listview1.Refresh()
End If
Next
I there something i'm doing wrong