title: c# Timer Stop Confusion
body: <p>I would like to set a textbox text to "blink" by changing text colors when a button is clicked.</p>
  
  <p>I can get the text to blink how I want it to, but I want it to stop after a few blinks. I cannot figure out how to make it stop after the timer fires a few times.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public Form1()
  {
      InitializeComponent();
  
      Timer timer = new Timer();
      timer.Interval = 500;
      timer.Enabled = false;
  
      timer.Start();
      timer.Tick += new EventHandler(timer_Tick);
  
      if (timerint == 5)
      timer.Stop();
  }
  
  private void timer_Tick(object sender, EventArgs e)
  {
      timerint += 1;
  
      if (textBoxInvFooter.ForeColor == SystemColors.GrayText)
          textBoxInvFooter.ForeColor = SystemColors.Highlight;
      else
          textBoxInvFooter.ForeColor = SystemColors.GrayText;
  }
  </code></pre>
  
  <p>I know my problem lies with how I'm using the "timerint", but I'm not sure where to put it, or what solution I should use...</p>
  
  <p>Thank you for all your help!</p>