title: C#: Need one of my classes to trigger an event in another class to update a text box
body: <p>Total n00b to C# and events although I have been programming for a while. </p>
  
  <p>I have a class containing a text box. This class creates an instance of a communication manager class that is receiving frames from the Serial Port. I have this all working fine. </p>
  
  <p>Every time a frame is received and its data extracted, I want a method to run in my class with the text box in order to append this frame data to the text box. </p>
  
  <p>So, without posting all of my code I have my form class...</p>
  
  <pre><code>public partial class Form1 : Form
  {
      CommManager comm;
  
      public Form1()
      {
          InitializeComponent();
          comm = new CommManager();
  
      }
  
      private void updateTextBox()
      {
          //get new values and update textbox
      }
      .
      .
      .
  </code></pre>
  
  <p>and I have my CommManager class</p>
  
  <pre><code>class CommManager 
  {
       //here we manage the comms, recieve the data and parse the frame
  }
  </code></pre>
  
  <p>SO... essentially, when I parse that frame, I need the updateTextBox method from the form class to run. I'm guessing this is possible with events but I can't seem to get it to work.</p>
  
  <p>I tried adding an event handler in the form class after creating the instance of CommManager as below...</p>
  
  <pre><code> comm = new CommManager();
   comm.framePopulated += new EventHandler(updateTextBox);
  </code></pre>
  
  <p>...but I must be doing this wrong as the compiler doesn't like it...</p>
  
  <p>Any ideas?!</p>