title: return a value from ElapsedEventHandler
body: <p>How can I return a value from ShowStatus elapsed event? Here is my code. I would like to return result as YES or NO.</p>
  
  <p>Thanks..</p>
  
  <pre><code>        Timer1 = new System.Timers.Timer();
          Timer1.Elapsed += new ElapsedEventHandler(ShowStatus);
          Timer1.Interval = 30000;
          Timer1.Enabled = true;
  
     public void ShowStatus(object source, ElapsedEventArgs evt)
      {
          try
          {
              Timer1.Enabled = false;
              string result;
  
              IPAddress ip = "127.0.0.1";
  
              result = FindStatus(ip.ToString()) ? YES: NO;
          }
          Timer1.Enabled = true;
      }
  
      public bool FindStatus(string ip)
      {
          Ping p = new Ping();
           ingOptions opts = new PingOptions();
              opts.DontFragment = true; 
              PingReply rc = p.Send(ip, 120, buff, opts);
              if (rc.Status.Equals(IPStatus.Success)) return true;
              return false;
      }
  </code></pre>