title: pass object between forms c#
body: <p>I am working on a form application that has two windows. In the main window, Form1 I create an instance of the class Treatment. I would like to pass that instance, once a image is clicked to the other window form2. So far I have:
  Form1:</p>
  
  <pre><code>public partial class Form1 : Form
  {
  
      private Treatment treatment;
  
  //method where i inistantiate the treatment
  private void processTreatment(int id, Button button)
      {
          treatment = new Treatment(wirelessResult, id);
          Alarm alarm = new Alarm(count, treatment);
          wirelessResult.GenerateNumber();
          alarm.setColor();
          events.add(alarm);
          if (getResult(treatment) == true)
          {
              storeSuccess(button);  
          }
          else if (getResult(treatment) == false)
          {
              storeFailed(button);
          }
      }
  // image clicked   
  private void treatmentStation1_Click(object sender, EventArgs e)
      {
  
          Form2 secondForm = new Form2(treatment);
          secondForm.Show();
      }
  </code></pre>
  
  <p>and in form2:</p>
  
  <pre><code>public partial class Form2 : Form
  {
      private Treatment treatment;
  
  
      public Form2()
      {
          InitializeComponent();
  
      }
  
      public Form2(Treatment treatment)
      {
          InitializeComponent();
          this.treatment = treatment;
      }
    }
  }
  </code></pre>
  
  <p>I get 1 error : Error   1   Inconsistent accessibility: parameter type 'WasteTreatment.Treatment' is less accessible than method 'WasteTreatment.Form2.Form2(WasteTreatment.Treatment)'</p>
  
  <p>Someone can help me to fix this?</p>