Question: I'm developing an application to send SMS via AT commands, that part is OK. I have a list of contacts and I want to send a file (which changes in time) to all of my contacts. In order to do that I need to repeat the sending part every 30 minutes.
I found this code using a timer, but I'm not sure if it's useful in my case and how I can use it. Please help, any idea is appreciated.

```
private void btntime_Click(object sender, EventArgs e)
    {
        s_myTimer.Tick += new EventHandler(s_myTimer_Tick);
        int tps = Convert.ToInt32(textBoxsettime.Text);

        // 1 seconde = 1000 millisecondes
        try
        {
            s_myTimer.Interval = tps * 60000;
        }
        catch
        {
            MessageBox.Show("Error");
        }
        s_myTimer.Start();

        MessageBox.Show("Timer activated.");

    }

    // Méthode appelée pour l'évènement
    static void s_myTimer_Tick(object sender, EventArgs e)
    {
        s_myCounter++;

        MessageBox.Show("ns_myCounter is " + s_myCounter + ".");

        if (s_myCounter >= 1)
        {
            // If the timer is on...
            if (s_myTimer.Enabled)
            {
                s_myTimer.Stop();
                MessageBox.Show("Timer stopped.");
            }
            else
            {
                MessageBox.Show("Timer already stopped.");
            }
        }
    }

```

Answer: 
Whether this code is useful or not depends entirely what you want to do with it. It shows a very basic usage of the Timer-class in .NET, which is indeed one of the timers you can use if you want to implement a repeating action. [I suggest you look at the MSDN-guidance on all timers in .NET](http://msdn.microsoft.com/en-us/magazine/cc164015.aspx) and pick the one that best fits your requirements.
You can start something like this. After all SMS are sent then after 30 seconds the SMS will be sent again.

```
    public Form1()
    {
        InitializeComponent();
        timer1.Enabled = true;
        timer1.Interval = (30 * 60 * 1000);
        timer1.Tick += SendSMS;
    }

    private void SendSMS(object sender, EventArgs e)
    {
        timer1.Stop();
        // Code to send SMS
        timer1.Start();
    }

```

Hope it helps.