title: Returning value with Task.Factory to Update the UI
body: <p>This should be pretty easy , but i couldn't find a adequated term to search for... Well I'm new to C# and i'm trying to make a simple App to write the return of a webservice.</p>
  
  <p>I came across the need to use a Thread... passing parameters to the thread is fairly easy , I couldn't find a way to return from the Threaded method and update my UI to show the result (well actually no the real result for now)</p>
  
  <p>The event:</p>
  
  <pre><code>    private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e)
      {
          minhaSigla = Sigla.Text;
          Task.Factory.StartNew(() =&gt; GetQuoteAndUpdateText(minhaSigla));
          tb1.Text = "UIElement-TO-UPDATE";
  
      }
  </code></pre>
  
  <p>And then the Threaded method</p>
  
  <pre><code>    private string GetQuoteAndUpdateText(string sign)
      {
          string SoapEnvelope = "";
          SoapEnvelope = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;";
          SoapEnvelope += "&lt;soap:Envelope ";
          SoapEnvelope += "xmlns:xsi = \"http://www.w3.org/2001/XMLSchema-instance\" ";
          SoapEnvelope += "xmlns:xsd= \"http://www.w3.org/2001/XMLSchema\" ";
          SoapEnvelope += "xmlns:soap= \"http://schemas.xmlsoap.org/soap/envelope/\"&gt;";
          SoapEnvelope += "&lt;soap:Body&gt;";
          SoapEnvelope += "   &lt;GetQuote xmlns=\"http://www.webserviceX.NET/\"&gt; ";
          SoapEnvelope += "       &lt;symbol&gt;" + sign + "&lt;/symbol&gt; ";
          SoapEnvelope += "   &lt;/GetQuote&gt; ";
          SoapEnvelope += "&lt;/soap:Body&gt;";
          SoapEnvelope += "&lt;/soap:Envelope&gt;";
  
          EndpointAddress endpoint = new EndpointAddress("http://www.webservicex.net/stockquote.asmx");
          BasicHttpBinding basicbinding = new BasicHttpBinding();
          basicbinding.SendTimeout = new TimeSpan(3000000000);
          basicbinding.OpenTimeout = new TimeSpan(3000000000);
  
          stockbyname.StockQuoteSoapClient sbn = new stockbyname.StockQuoteSoapClient(basicbinding, endpoint);
  
          XmlDocument xmlDocument = new XmlDocument();
          return sbn.GetQuote(SoapEnvelope);
      }
  </code></pre>
  
  <p>Also any information will be much appreciated, even comments about how awful my code is :P</p>