|
-
Nov 15th, 2001, 11:30 AM
#1
Thread Starter
Addicted Member
Can anyone modify Do Loop?
Hi I have a timer starting from 0 with Interval 1000 when I press command button.I need to modify this do loop to see if it has If InStr(Instring, vbCr) Then exit Do Loop if it didn't get response wait for 30 seconds and exit from the loop.Can any one modify this Do Loop to satisy both conditions please?
Private Sub Command1_Click()
On Error GoTo Message
Dim Instring As String
StartTiming
frmTerminal.MSComm1.InputLen = 0
frmTerminal.MSComm1.Output = "1;1;CLOSE" & Chr$(13)
If Err Then Exit Sub
Do
Instring = Instring & frmTerminal.MSComm1.Input
DoEvents
If InStr(Instring, vbCr) Then
Exit Do
End If
Loop
DoEvents
'MsgBox "Closing:" & Instring
Text1.ForeColor = &HFF0000
Text1.Text = Instring
Exit Sub
Message:
MsgBox Err & " " & Error
End Sub
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|