Hi, I'm new here and to c#. I have this minor problem with c#. Heres the code (simplified):

public partial class Form1 : Form
{
        static System.Timers.Timer myTimer;
        static Manager manager;

        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            manager = new TorrentManager();
            System.Timers.Timer myTimer = new System.Timers.Timer();
            myTimer.Elapsed += new ElapsedEventHandler(UpdateGui);
            myTimer.Interval = 5000;
            myTimer.Start();
        }
        public static void UpdateGui(object source, ElapsedEventArgs e)
        {
           if (manager != null)
           {
           }
        }
}

The problem is that when the UpdateGui handler is fired, manager becomes null, even though it's static. Thanks in advance.

it should be null!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.