title: How to call a method from a button in C#
body: <p>I have a button in C#:</p>
  
  <pre><code>private void button15_Click(object sender, EventArgs e)
  {
  
      StartService();
  }
  </code></pre>
  
  <p>and I try to call the method:</p>
  
  <pre><code>public static void StartService(string serviceName, int timeoutMilliseconds)
  {
      ServiceController service = new ServiceController(serviceName);
      try
      {
          TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds);
  
          service.Start();
          service.WaitForStatus(ServiceControllerStatus.Running, timeout);
      }
      catch
      {
          // ...
      }
  }
  </code></pre>
  
  <p>But I am not sure if the call method is correct on the button</p>