Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to enable a timer tick event in a Data Received Handler Event?

Posted on 2013-01-21
4
Medium Priority
?
514 Views
Last Modified: 2013-01-27
I have a the following code: that it executes howeverI can never get my timer tick event to fire after the condition is met in the indata.length is met????

frmMain()
SetupSerialAutomationDataReceivedCOMPort()
End Sub

Public Sub SetupSerialAutomationDataReceivedCOMPort()
       Dim mySerialPort As New SerialPort("COM1")
        mySerialPort.BaudRate = 9600
        mySerialPort.Parity = Parity.None
        mySerialPort.StopBits = StopBits.One
        mySerialPort.DataBits = 8
        mySerialPort.Handshake = Handshake.None
        AddHandler mySerialPort.DataReceived, AddressOf DataReceivedHandler
mySerialPort.Open()
End Sub

  Private Sub DataReceivedHandler(
                        sender As Object,
                        e As SerialDataReceivedEventArgs)
        Dim sp As SerialPort = CType(sender, SerialPort)
        Dim indata As String = sp.ReadExisting()
   
if indata.length=21 then
tmrPartfileLoaded.start()
end if

    End Sub
0
Comment
Question by:cmdolcet
  • 2
  • 2
4 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38801826
Does the condition evaluate to true? How do you know timer event is not firing? Do you have a breakpoint in there?
0
 

Accepted Solution

by:
cmdolcet earned 0 total points
ID: 38805551
Yes it does. I did figure it out thought. I used an Invoke and a timer .start() to trigger the timer.

me.Invoke(New MethodInvoker(Addressof me. timer.start))

How can I close this now?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38805563
Select your comment as the answer.
0
 

Author Closing Comment

by:cmdolcet
ID: 38823791
I found the solution myself by using the invoke method.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question