How do i change the value of the variable levels only when changing the value in numericUpDown?
<p>I have this code:</p>

<pre><code>private List&lt;string&gt; test(string url, int levels, DoWorkEventArgs eve)
{
  HtmlWeb hw = new HtmlWeb();
  List&lt;string&gt; webSites;
  try
  {
    doc = hw.Load(url);
    webSites = getLinks(doc);
    removeDupes(webSites);
    removeDuplicates(webSites, currentCrawlingSite);
    removeDuplicates(webSites, sitesToCrawl); // like this..
    if (downLoadImages == true)
    {
      retrieveImages(url);
    }
    if (levels &gt; 0)
      sites.AddRange(webSites

    if (levels == 0)
    {
      return csFiles;
    }
    else
    {
      for (int i = 0; i &lt; webSites.Count(); i++)//&amp;&amp; i &lt; 20; i++)
      {
        int mx = Math.Min(webSites.Count(), 20);
        if ((worker.CancellationPending == true))
        {
          eve.Cancel = true;
          break;
        }
        else
        {
          string t = webSites[i];
          if ((t.StartsWith("http://") == true) || (t.StartsWith("https://") == true)) 
          {
            actual_sites++;
            csFiles.AddRange(test(t, levels - 1, eve));
</code></pre>

<p>And I have this numericupdown event:</p>

<pre><code>private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{

}
</code></pre>

<p>What I need is that when the user change the numericUpDown value it will change in real time the value of the variable levels in the function test. But I don't want to call/activate again the function test only to change the value of levels. If I run the program and its working now using the function test and the level is 1 so if I change the numericUpDown to 4 so levels is now 4 so the program will keep on working but now levels will be 4 and not 1.</p>

<p>How can I do it?</p>
