Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy when calling the function in the numericUpDown changed event making everything slow after some times?
    text
    copied!<p>This is the code in the <code>NumericUpDown</code> <code>ValueChanged</code> event:</p> <pre><code>private void numericUpDown1_ValueChanged(object sender, EventArgs e) { DoThresholdCheck(); } </code></pre> <p>And this is the <code>DoThresholdCheck()</code> code:</p> <pre><code>private void DoThresholdCheck() { List&lt;int&gt; f; List&lt;string&gt; fts; const string D6 = "000{0}.bmp"; if (Directory.Exists(subDirectoryName)) { if (!File.Exists(subDirectoryName + "\\" + averagesListTextFile + ".txt")) { return; } else { f = new List&lt;int&gt;(); fts = new List&lt;string&gt;(); Bitmap myFiles; int counter = 0; double thershold = (double)numericUpDown1.Value; double max_min_threshold = (thershold / 100) * (max - min) + min; _fi = new DirectoryInfo(subDirectoryName).GetFiles("*.bmp"); for (int i = 0; i &lt; myNumbers.Count; i++) { if (myNumbers[i] &gt;= max_min_threshold) { string t = i.ToString("D6") + ".bmp"; if (File.Exists(subDirectoryName + "\\" + t)) { button1.Enabled = false; myTrackPanelss1.trackBar1.Enabled = true; } else { button1.Enabled = true; myTrackPanelss1.trackBar1.Enabled = false; pictureBox1.Image = Properties.Resources.Weather_Michmoret; label5.Visible = true; break; } } } if (myTrackPanelss1.trackBar1.Maximum &gt; 0) { SetPicture(0); myTrackPanelss1.trackBar1.Scroll += new EventHandler(trackBar1_Scroll); } if (_fi.Length &gt;= 0) { label15.Text = _fi.Length.ToString(); label15.Visible = true; } } } else { button1.Enabled = true; } } </code></pre> <p>What I want to do is; each time I change the <code>NumericUpDown</code> value in the program it will call the function in the event. In the event I create a new temp list each time and perform operations and make some checks on that list.</p> <p>The problem is when I'm changing the <code>NumericUpDown</code> value a few times up and down in the program and then try to use the <code>trackBar1</code> to move between the images again, the <code>trackbar1</code> moves very slowly. When initially running the program, the slide bar in the <code>trackbar1</code> moves quickly and moves quickly between images, but when I change the <code>NumericUpDown</code> values the trackbar moves slowly for some reason.</p> <p>I tried to add a <code>Timer2</code> and maybe use it in the <code>NumericUpDown</code> to make it call the function only after 500ms, for example, but it didn't solve it.</p> <p>I can't figure out why its moving so slow.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload