title: How to call another function in the "static main" method?
body: <p>I am a beginner of C# and I would like to call a function namely <code>SetTimer()</code> in the <code>static void Main()</code> but it gave some errors as <code>SetTimer(11, 48, 00);</code> and <code>SetTimer(11, 35, 40);</code> below. Actually, it might work well in a Form vice versa with the <code>Main()</code> function. I got so confused about how and when to use these types:</p>
  
  <ul>
  <li>public void</li>
  <li>static void</li>
  <li>public static void</li>
  <li>private static void</li>
  <li>void</li>
  </ul>
  
  <hr>
  
  <pre><code>using Microsoft.Win32;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading;
  using System.Windows.Forms;
  
  namespace SetTimerAlert
  {
      public class Program
      {
          int count = 0;
  
          /// &lt;summary&gt;
          /// The main entry point for the application.
          /// &lt;/summary&gt;
          [STAThread]
          static void Main()
          {
              //Application.EnableVisualStyles();
              //Application.SetCompatibleTextRenderingDefault(false);
              //Application.Run(new Form1());
  
              RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
  
              //Application.Run(new Form1());
              if (rkApp.GetValue("SetTimerAlert") == null)
              {
                  Application.Run(new Form1());
              }
              else
              {
                  SetTimer(11, 48, 00);
                  SetTimer(11, 35, 40);
              }
          }
  
          public void SetTimer(int hh, int mm, int ss)
          {
              DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hh, mm, ss);
              TimerCallback callback = new TimerCallback(ProcessTimerEvent);
  
              if (DateTime.Now &lt; dt)
              {
                  var timer = new System.Threading.Timer(callback, null,
                      //other occurrences every 24 hours
                                  dt - DateTime.Now, TimeSpan.FromHours(24));
              }
          }
  
          public void ProcessTimerEvent(object obj)
          {
              if (count == 0)
              {
                  //rkApp.SetValue("SetTimerAlert", Application.ExecutablePath.ToString());
                  MessageBox.Show("Please run programs.");
                  count++;
              }
              else
              {
                  MessageBox.Show("Hey! I did not see the program runs. Your computer will be shut down for 15 seconds.");
              }
          }
      }
  }
  </code></pre>