im having problem with this code, what i want it to do it go on the site nd if it finds the word online it switches the text
so say it directed to google and the word online is somewhere in the html code of the site, the app should then change label 5 to online
BUT i get this error
"Could not find file 'C:\Users\Owner\Desktop\AMi BETA\AMi BETA\bin\Debug\www.google.com'."
-----------------------
everything i want the notifyicon to do is working but i only want it to pop up once but every time the timer ticks it pops up
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ServerStatus.Tick
Dim LB5 As String = Label5.Text
Dim wc As New System.Net.WebClient()
Dim sr As New IO.StreamReader(wc.OpenRead(LB5))
Dim s As String = sr.ReadToEnd()
sr.Close()
If s.Contains("Online") Then
Status.Text = "Online"
Status.ForeColor = Color.LimeGreen
If Me.Visible = False Then
'Tip Pops up
NotifyIcon1.BalloonTipText = Label1.Text & " is Online!"
NotifyIcon1.ShowBalloonTip(5000)
End If
Else
Me.Status.Text = "Offline"
Status.ForeColor = Color.Red
End If
End Sub
If s.Contains("Online") Then
Status.Text = "Online"
Status.ForeColor = Color.LimeGreen
If Me.Visible = False Then
'Tip Pops up
NotifyIcon1.BalloonTipText = Label1.Text & " is Online!"
NotifyIcon1.ShowBalloonTip(5000)
End If
Else
Me.Status.Text = "Offline"
Status.ForeColor = Color.Red
End If
thats the problem, when the program is in the taskbar it spams the notifyicon and i only what it to pop up once for evey time it changes from offline to online
Use a var to save the last state, and then in the tick event, check if the current state it's like the last state, if it's equal don't do anything, if not, show the notify icon and set the last state equals to the current state...
Rate People That Helped You Mark Thread Resolved When Resolved