title: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on
body: <pre><code>private void MMScrpt()
  {
      try
      {
         MySqlConnectionStringBuilder connBuilder = new MySqlConnectionStringBuilder();
  
         connBuilder.Add("Database", databaseMM);
         connBuilder.Add("Data Source", "localhost");
         connBuilder.Add("User Id", "root");
         connBuilder.Add("Password", txtPassword.Text);
  
         MySqlConnection connection = new MySqlConnection(connBuilder.ConnectionString);
         MySqlCommand cmd = connection.CreateCommand();
  
         connection.Open();
         progressBar1.Minimum = 0;
         progressBar1.Step = 1;
         progressBar1.Value = 0;
  
         string MMScript = Properties.Resources.millmancompany;
         string[] tokens = MMScript.Split(';');
         progressBar1.Maximum = tokens.Length;
         for (int i = 0; i &lt; tokens.Length; i++)
         {
             MMtokens = tokens[i];
             cmd.CommandText = MMtokens.ToString();
             cmd.CommandType = CommandType.Text;
             cmd.ExecuteNonQuery();
             progressBar1.PerformStep();
         }
         connection.Close();
         connection.Close();
     }
  
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error Message");
     }
  }
  
  private void BTNsriptRUN_Click(object sender, EventArgs e)
  {
  
      Thread tr1 = new Thread(new ThreadStart(MMScrpt));
  
      tr1.Start();
      //MMScrpt();
  
  }
  </code></pre>