title: How does one access a control from a static method?
body: <p>I have an application in C# .NET which has a <code>MainForm</code> and a few classes.</p>
  
  <p>One of these classes receives incoming data messages from a network. I need to get these message's text appended into a multi-line textbox on the <code>MainForm</code>.</p>
  
  <p>I can send the message to a method in the <code>MainForm</code> by making the method static, but then the static method cannot access the <code>MainForm</code>'s controls.</p>
  
  <p><strong>TheIncomingDataClass.cs</strong></p>
  
  <pre><code>namespace TheApplicationName
  {
       class TheIncomingDataClass
       {
  
       public void IncomingMessage(IncomingMessageType message)
       {
            TheApplicationName.MainForm.ReceiveMSG(message);
       }
  </code></pre>
  
  <p><strong>MainForm.cs</strong></p>
  
  <pre><code>public static void ReceiveMSG(string message)
  {
       txtDisplayMessages.AppendText(message); //This line causes compile error
  }
  </code></pre>
  
  <p>The compile error:</p>
  
  <blockquote>
    <p>An object reference is required for the nonstatic field, method, or
    property 'TheApplicationName.MainForm.txtDisplayMessages'</p>
  </blockquote>