Search code examples
c#timer

Using a Timer in C#


I'm trying to make a form invisible for x amount of time in c#. Any ideas?


Solution

  • BFree has posted similar code in the time it took me to test this, but here's my attempt:

    this.Hide();
    var t = new System.Windows.Forms.Timer
    {
        Interval = 3000 // however long you want to hide for
    };
    t.Tick += (x, y) => { t.Enabled = false; this.Show(); };
    t.Enabled = true;