Hello. I have a 99% working code. It's one problem. When i press button 3 it dosen't change site over and over agin.
It changes site to nummber 1, but no more.
The problem is that b has no value. But the code "b = b + 1" makes [B]b/B] get value 1. But later when i press the button 3, im still on the site 1. The b can only got value 1.
How do I save the value in b så b = b + 1 can be 2 or more.
Code:Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim changesSE(2) As String Dim changesUS(2) As String Dim b As Integer Dim dtCurrent As System.DateTime Dim tdCurrent As System.DateTime Dim iMin As Integer Dim iHour As Integer ' time dtCurrent = dtCurrent.Now() tdCurrent = tdCurrent.Now() iMin = tdCurrent.Minute iHour = dtCurrent.Hour ' companys changesSE(0) = "www.google.se" changesSE(1) = "www.jesper.nu" changesSE(2) = "www.ubuntu-se.org" changesUS(0) = "www.microsoft.com" changesUS(1) = "www.youtube.com" changesUS(2) = "www.hotmail.com" If (iHour >= 9) And (iHour <= 17) And (iMin < 30) Then b = b + 1 WebBrowser1.Navigate(changesSE(b)) If (b = 24) Then b = 0 Else b = b End If ElseIf (iHour >= 9) And (iHour <= 17) And (iMin > 30) Then b = b + 1 WebBrowser1.Navigate(changesSE(b)) If (b = 24) Then b = 0 Else b = b End If ElseIf (iHour >= 17) And (iMin >= 30) And (iHour <= 21) Then b = b + 1 WebBrowser1.Navigate(changesUS(b)) If (b = 24) Then b = 0 Else b = b End If ElseIf (iHour >= 17) And (iMin <= 30) And (iHour <= 21) Then b = b + 1 WebBrowser1.Navigate(changesUS(b)) If (b = 24) Then b = 0 Else b = b End If ElseIf (iHour = 21) And (iMin > 30) Then b = 0 ' set b as value 0 System.Threading.Thread.Sleep(39750000) ' sleep untill kl 9.00 End If End Sub


Reply With Quote