MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Private Sub StartScanning(mscomm As mscomm, objTimer As Timer, objTimer2 As Timer) Dim bStarted As Boolean Dim sInstring As String Dim bDone As Boolean On Error GoTo Errorhandler bStarted = False DoEvents objTimer.Enabled = True sInstring = "" txtInput.Text = "" bDone = False bStop = False 'Tell the control to read entire buffer when Input is used mscomm.InputLen = 0 If mscomm.PortOpen = False Then mscomm.PortOpen = True End If StatusBar1.Panels(1).Text = "Waiting for Scanned Labels ..." StatusBar1.Panels(1).Width = StatusBar1.Width - (StatusBar1.Panels(2).Width + StatusBar1.Panels(3).Width) sInstring = "" 'Do While Not bDone Do While bStop = False DoEvents Do While mscomm.InBufferCount > 0 StatusBar1.Panels(1).Text = "Reading Scanned Labels ..." StatusBar1.Panels(1).Width = StatusBar1.Width - (StatusBar1.Panels(2).Width + StatusBar1.Panels(3).Width) bStarted = True DoEvents 'do not switch to line after to see newly scanned labels first - did not work 'sInstring$ = MSComm1.Input & sInstring$ 'next line is the right order sInstring$ = sInstring$ & mscomm.Input txtInput.Text = sInstring objTimer.Interval = 100 objTimer.Enabled = True Do While objTimer2.Enabled = True DoEvents Loop Loop If mscomm.InBufferCount = 0 And bStarted = True Then bDone = True End If Loop txtInput.Text = sInstring objTimer.Enabled = False If mscomm.PortOpen = True Then mscomm.PortOpen = False End If ' ' * make the call to stop based on the control passed as parameter object ' If bStop = True Then ' Select Case mscomm ' Case MSComm1 ' Call cmdStop_Click ' Case MSComm2 ' Call cmdStop2_Click ' Case MSComm3 ' Call cmdStop3_Click ' End Select ' End If Exit Sub Errorhandler: If Err = 8005 Then MsgBox ("Port Already Open - Change Settings and Select a Different Port Number") Err.Clear Exit Sub End If If Err = 8002 Then MsgBox ("Invalid Port Number - Change Settings and Select a Different Port Number") Err.Clear Exit Sub End If Err.Clear End Sub Private Sub cmdStop2_Click() Call StopScanning(MSComm2, gsScanner2) End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.