Afternoon all.
I'm hoping someone can help me with this annoyance.
Basically where i have the line LblStatus.Text = "check IP address!", this only displays if i have exit sub after it. If i take that away, then this message never shows. I'm a bit stumped why it doesn't. I'm no expert in programming! I want the code to just go round in a loop every 60 seconds and do the IP address check. I'm sure it's a simple answer!
Here is my code, slightly shortened as it is a bit repetitive...
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ticker:
Dim sString As String
Dim strIPAddress As String
Dim strhostname As String
Dim Prefix As String
strhostname = System.Net.Dns.GetHostName()
strIPAddress = System.Net.Dns.GetHostByName(strhostname).AddressList(0).ToString()
lblIPAddress.Text = "IP Address: " & strIPAddress
Try
Prefix = strhostname.Substring(0, 3)
'Check the IP address of the local machine
Dim ipArray() As String = Split(strIPAddress, ".")
If ipArray(1) = "44" And ipArray(2) = "10" Then
LblStatus.Text = "Your PC is updating, please wait......."
LblShip.Text = "This PC is in the Office"
Using sr As New StreamReader("\bm-filesrv\Timesync$\timezone.ini")
sString = sr.ReadToEnd()
End Using
Else
Try
LblShip.ForeColor = Color.Red
LblStatus.ForeColor = Color.Red
LblShip.Text = "Unable to identify location"
LblStatus.Text = "check IP address!"
Exit Sub
GoTo Timertick
Catch ex As Exception
LblStatus.Text = (ex.Message)
End Try
goto ticker
end if
Appreciate any assistance with this.
Thanks
Simon