Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

start stop loop

Status
Not open for further replies.

Newf69

Technical User
Mar 27, 2003
7
CA
here is my code. I want a way to automatically restart the program without having to exit and restart again. Any help would be greatly appreciated.

Option Explicit
Dim intEnd As Integer

Private Sub cmdExit_Click()
intEnd = 1
End

End Sub

Private Sub cmdStart_Click()
MSComm1.PortOpen = True

Do Until MSComm1.DSRHolding = True Or intEnd = 1
Delay 1
If MSComm1.DSRHolding = False Then
MSComm1.Output = Chr$(1)

End If
Loop
If MSComm1.DSRHolding = True Then
MSComm1.Output = Text1.Text

End If
MSComm1.PortOpen = False
End Sub

Private Sub Form_Load()
frmCaution.Top = (Screen.Height - frmCaution.Height) / 2
frmCaution.Left = (Screen.Width - frmCaution.Width) / 2

End Sub


Private Sub Delay(HowLong As Date)
Dim TempTime As Date
TempTime = DateAdd("s", HowLong, Now)
While TempTime > Now
DoEvents 'Allows windows to handle other stuff
Wend

End Sub

 
I understand you don't want to quit your program? Is this correct?

How about removing the exit command button and the controlbox from your form ?
Or set the Cancel on true in your form unload event.

Robert

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top