Hi guys.


All in FORM1

public partial class Form1 : Form
    {  
Thread thread;

public Form1()
        {
thread = new Thread(run);
            thread.Start();   
        }
public void run()
        {
          ConectadoThread socketConectado = new ConectadoThread(); 
        }
private void Form1_FormClosing(object sender, FormClosingEventArgs e)

        {    

            socketConectado.close();

        }

 }

Why when i do "socketConectado.close()" it shows me:

Error 2 The name 'socketConectado' does not exist in the current context C:\Users\Mauri\Desktop\Proyectos\Visual Studio 2008\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Form1.cs

Thanks =)

public partial class Form1 : Form
    {  
      Thread thread;
      public Form1()
        {
            thread = new Thread(run);
            thread.Start();   
        }
      ConectadoThread socketConectado;
      public void run()
        {
            socketConectado = new ConectadoThread(); 
        }
      private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {    
            socketConectado.close();
        }
 }