Starting Windows Forms timer in event handler
<p>Noob here trying to understand why I cannot jump into my <code>aTimer</code> elapsed function when I start it in the event handler. I must not be able to start the timer in the event handler I'm guessing. I can enter the time elapsed function when I start it outside of the serialPortDataReceived handler. </p>

<p>The following is all in the same class using Windows Forms:</p>

<pre><code>private System.Windows.Forms.Timer aTimer = new System.Windows.Forms.Timer(); 
</code></pre>

<p>and initilize it:</p>

<pre><code> aTimer.Tick += new EventHandler(TimerEventProcessor);
aTimer.Interval = 80;

private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
        {

            try
            {
                SerialPort sp = (SerialPort)sender;
                indata = sp.ReadExisting();
                if(indata != "")
                    updateLabelText(indata); //don't update if data is a blank
            }
            catch (System.Exception ex)
            {
                this.timeOutLabel.Text = ex.Message;
            }

            rx = true;
            showActivity = true;
            pictureBox3.Invalidate();

            if(blink == 0) //start the timer if it has not been started already
                if(!aTimer.Enabled)
                    aTimer.Start();

        }
</code></pre>

<p>but this code jumps into the timer function:</p>

<pre><code>private void sendButton_Click(object sender, EventArgs e)
        {

            bool errFlag = false;

            showActivity = true;
            pictureBox3.Invalidate();

            try
            {

                //Write a line to serial port
                sp.Write(textBox.Text); //Don't use sp.WriteLine since it sends the "\n"

            }
            catch (System.Exception ex)
            {
                errFlag = true;
            }
            if (!errFlag)
            {
                txLabel.Show();
                aTimer.Start();
            }
        }
</code></pre>

<p>Timer elapsed function:</p>

<pre><code>private void TimerEventProcessor(object source, EventArgs e)
        {

            change_color ^= true;

            if (blink++ == 5)
            {
                blink = 0;
                rx = false;
                tx = false;
                aTimer.Stop();
            }

            pictureBox3.Invalidate();

        }
</code></pre>
