title: How can I correctly pass an input parameter to an event handler method in C#?
body: <p>I am pretty new in <strong>C#</strong> and <strong>.NET</strong> and I have the following problem.</p>
  
  <p>In my code I have something like this:</p>
  
  <pre><code>Table table = new Table();
  
  lstLabelType.SelectedIndexChanged += new System.EventHandler(SelectDocumentTypeChanged);
  </code></pre>
  
  <p>that is attaching an event handler to a dropdown element into a view.</p>
  
  <p>So when the user change the chosen value into this dropdown the <strong>SelectDocumentTypeChanged()</strong> method is performed, this one:</p>
  
  <pre><code>private void SelectDocumentTypeChanged(object sender, EventArgs e)
  {
      Debug.WriteLine("SelectDocumentTypeChanged() STARTED");
  
      SPWeb contextWeb = SPContext.Current.Web;
  
      DropDownList listaTipiDocumenti = (DropDownList)sender;
      tipoDocumentoSelezionato = listaTipiDocumenti.SelectedValue;
      this.renderizzaEtichetteFacoltative(tipoDocumentoSelezionato, table);
  
      string url = contextWeb.Url;
      string link = url + "/ARXEIA WEBPART/Stampa Etichetta.aspx?IsDlg=1&amp;postazione=" + macchina + "&amp;tipoDoc=" + tipoDocumentoSelezionato;
      SPUtility.Redirect(link, SPRedirectFlags.Default, Context);
  
  
  }
  </code></pre>
  
  <p>Now I have a problem. I have to pass to this event handler method the <strong>Table table</strong> object created in my code because into this method I have to use it.</p>
  
  <p>How can I correctly implement this behavior? How can I pass this <strong>Table table</strong> object to the <strong>SelectDocumentTypeChanged()</strong> method when it is automatically called when the user change the value in my dropdown?</p>