title: C# Load Event not Firing
body: <p>I am learning C# and am having trouble with the firing of the load system event.  It was working fine until I linked form1 and form2 together to pass variables between them.  IE set the label on Form one from the selected item on form2.  Thanks for any help!</p>
  
  <p>Here is my code for Form1:</p>
  
  <pre><code> namespace WindowsFormsApplication5
   {
  public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
  
  
      private void button1_Click(object sender, EventArgs e)
      {
          selectdb selectdb = new selectdb(this); // this is the button that shows the form in question.  It worked fine until I added the (this).
          selectdb.Show();
      }
  
      public string LabelText
      {
          get { return label1.Text; }
          set { label1.Text = value; }
      }
  
  }
  
  }
  </code></pre>
  
  <p>Here is my code for Form2:</p>
  
  <pre><code> namespace WindowsFormsApplication5
  {
  public partial class selectdb : Form
  {
  
      public selectdb()
      {
          InitializeComponent();
          //this.Name = "selectdb";
          //this.Text = "selectdb";
          this.Load += new System.EventHandler(selectdb_Load);
  
      }
      private Form1 mainForm = null;
  
      public selectdb(Form callingForm)
      {
          mainForm = callingForm as Form1;
          InitializeComponent();
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          this.mainForm.LabelText = listBox1.SelectedItem.ToString();
      }
  
      private void selectdb_Load(Object sender, EventArgs e)
      {
          // Microsoft Access provider factory 
          DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");
  
          DataTable userTables = null;
          using (DbConnection connection = factory.CreateConnection())
          {
              connection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\"C:\\Database.accdb\";Persist Security Info=False;";
              // We only want user tables, not system tables 
              string[] restrictions = new string[4];
              restrictions[3] = "Table";
  
              connection.Open();
  
              // Get list of user tables 
              userTables = connection.GetSchema("Tables", restrictions);
          }
  
          List&lt;string&gt; tableNames = new List&lt;string&gt;();
          for (int i = 0; i &lt; userTables.Rows.Count; i++)
              listBox1.Items.Add(userTables.Rows[i][2].ToString());
  
      }
  
  }
  }
  </code></pre>