title: Why won't my textbox update when I am doing the exact same thing just with a different function?
body: <p>My TextBox won't update! I am using it as a Log to update what other things are doing... </p>
  
  <p><strong>Form 1 code:</strong></p>
  
  <pre><code>using System;
  using System.Drawing;
  using System.Collections;
  using System.ComponentModel;
  using System.Windows.Forms;
  using System.Data;
  using System.IO;
  using System.Data.OleDb;
  using System.Collections.Specialized;
  using System.Text;
  
  delegate void logAdd(string message);
  
  namespace LCR_ShepherdStaffupdater_1._0
  {
      public partial class Main : Form
      {
          public Main()
          {
              InitializeComponent(); 
          }
  
          public void logAdd(string message)
          {
              this.Log.Items.Add(message); // Doesnt add to textbox
  
              this.Log.Items.Add("This won't update the textbox!!! Why?"); // Doesnt add to textbox
          }
  
          private void exitProgramToolStripMenuItem_Click(object sender, EventArgs e) 
          {
              Application.Exit(); 
          }
          private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
          {
              Form aboutBox = new AboutBox1(); 
              aboutBox.ShowDialog(); 
          }
  
          private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
          {
          }
  
          private void settingsToolStripMenuItem1_Click(object sender, EventArgs e)
          {
              settingsForm.settings.ShowDialog();
          }
  
          private void synchronize_Click(object sender, EventArgs e)
          {
              this.Log.Items.Add("This WILL update the textbox. It is exactly the same as the other one..."); // This will add to the textbox
              DatabaseHandling.createDataSet();
          }
  
      }
  
      public class settingsForm 
      {
          public static Form settings = new Settings();
      }
  
  }
  </code></pre>
  
  <p><strong>My Logging Class code:</strong> </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace LCR_ShepherdStaffupdater_1._0
  {
      public class Logging
      {
          static Main mainClass = new Main();
          static logAdd logAddDelegate;
  
          public static void updateLog(string message)
          {
              logAddDelegate = mainClass.logAdd;
              logAddDelegate(message);
          }
      }
  }
  </code></pre>
  
  <p>I am just completely stumped....does anyone know how I can fix the logAdd function so I can get my textbox log to finally update?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I finally got it to work, here was the fix:</p>
  
  <p><strong>Form1 Code</strong></p>
  
  <pre><code>using System;
  using System.Drawing;
  using System.Collections;
  using System.ComponentModel;
  using System.Windows.Forms;
  using System.Data;
  using System.IO;
  using System.Data.OleDb;
  using System.Collections.Specialized;
  using System.Text;
  
  delegate void logAdd(string message);
  
  namespace LCR_ShepherdStaffupdater_1._0
  {
      public partial class Main : Form
      {
          public Main()
          {
              InitializeComponent(); 
          }
  
          public void add(string message)
          {
              this.Log.Items.Add(message);
          }
          public void logAdd(string message)
          {
              Log.Invoke(new logAdd(add), new object[] { message });
          }
  
          private void exitProgramToolStripMenuItem_Click(object sender, EventArgs e) 
          {
              Application.Exit(); 
          }
          private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
          {
              Form aboutBox = new AboutBox1(); 
              aboutBox.ShowDialog(); 
          }
  
          private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
          {
          }
  
          private void settingsToolStripMenuItem1_Click(object sender, EventArgs e)
          {
              settingsForm.settings.ShowDialog();
          }
  
          private void synchronize_Click(object sender, EventArgs e)
          {
              logAdd("this works");
          }
  
      }
  
      public class settingsForm 
      {
          public static Form settings = new Settings();
      }
  
  }
  </code></pre>
  
  <p><strong>Logging Code:</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  namespace LCR_ShepherdStaffupdater_1._0
  {
      public class Logging
      {
          static Main mainClass = new Main();
          static logAdd logAddDelegate;
  
          public static void updateLog(string message)
          {
              logAddDelegate = mainClass.logAdd;
              logAddDelegate(message);
          }
      }
  }
  </code></pre>
  
  <p>Well...I can tell that is a really bad way to do it...but until I find a true fix as long as it works im happy. Thanks for the help guys!</p>