title: c# using the same class instance between two forms for tcp
body: <p>Ok, so i have got myself completely stuck. My search skill are lacking and I cant find anything that makes me see what I need to do. </p>
  
  <p>What I have is a Telnet App. Form1 connects and preforms the socket stuff though a class. The class is refernced on form one like so</p>
  
  <pre><code>//form1
  telnet tc;
  
  private void connect_Click(object sender, EventArgs e)
  {
    tc = new telnet (IP, Port);
  }
  </code></pre>
  
  <p>What I am trying to do is use this same method on form2. form2 is a configuration window and requires getting data from the telnet server to save to an xml file. via</p>
  
  <pre><code> //form 1
   tc.read();
  </code></pre>
  
  <p>I could call a new instance of the telnet class but that would be a waste of resources and I think there's a better way to code it. </p>
  
  <p>So what I would like to know is, while in form2. How do I tell a button click event to access tc from form1? </p>
  
  <p>So far I haven't been able to figure out how to get the reference of form1 tc, or the connect_click button onto form 2.</p>
  
  <pre><code> //form2
   private void read_click(object sender, EventArgs e)
   {
     tc.read();  // how do i call it? or even call a method of form 1 to button click?
     ... write data from tc.read()
    }
  </code></pre>