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
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