Infinite loop with Webbrowser

I made a database that is updated by webpages.
I want to read this database and send those changes to an external device connected on my serial port.

It seems that the first page is opened correctly but then it kinda locks and doesn't do anything.

Please help or ideas needed.



Here is a part of my code:

Private Sub cmdPortOpen_Click()
Dim I As Integer
MSComm1.CommPort = Combo1.ListIndex
MSComm1.InputLen = 0
MSComm1.PortOpen = True
cmdPortOpen.Enabled = False
cmdPortClose.Enabled = True
cmdStatus.Enabled = True
Label2.Caption = MSComm1.Input
lblSTATUS.Caption = "OPENED"
cmdStatus.Value = True
I = 1
While I=1
WebBrowser1.Navigate ("http://www.romania-online.info/dvdt/www/statussw.php?dummy=" & Rnd(100))
WebBrowser1.Visible = True
While WebBrowser1.Busy: DoEvents: Wend
SW1 = WebBrowser1.Document.All("sw1").Value
If SW1 = "1" Then
SendSW1
ResetSW1
End If
Wend
End Sub


Private Sub cmdSW1_Click()
SendSW1
End Sub

Private Sub SendSW1()
MSComm1.InputLen = 0
Label2.Caption = MSComm1.Input
MSComm1.Output = "SW1" + vbCrLf
Recieve_Answer
End Sub

Private Sub ResetSW1()
WebBrowser1.Navigate ("http://www.romania-online.info/dvdt/www/resetsw.php?sw=1&dummy=" & Rnd(100))
While WebBrowser1.Busy: DoEvents: Wend
End Sub

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories