'用一个Timer控件定时扫描本机IP
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim OldIp As IPAddress
'原本机IP
OldIp = IPAddress.Parse("192.168.0.137")
Dim ipList As IPHostEntry
'获取本机IP列表
ipList = Dns.GetHostByName(Dns.GetHostName)
Dim i As Integer
'遍历IP列表,对比有没有修改
For i = 0 To ipList.AddressList.Length - 1
If ipList.AddressList(i).ToString.Equals(OldIp.ToString) = False Then
MsgBox("IP已经被修改")
End If
Next
End Sub