Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. private void textBox1_TextChanged(object sender, EventArgs e) {
  2.  
  3.  
  4. if (textBox1.Text.Length > 3) {
  5. active++;
  6.  
  7. Draw(textBox1.Text);
  8. //
  9. } else if (textBox1.Text.Length == 0) LoadSVnew();
  10. }
  11.  
  12. //static int active = 0,run=0;//method1
  13.  
  14. void Draw(string t) {
  15. tsk = new Task(delegate{
  16.  
  17. string lastq = "";
  18. Invoke(new MethodInvoker(delegate { lastq = textBox1.Text; })); // method 2
  19.  
  20. Thread.Sleep(500);
  21.  
  22. //method 1
  23. //run++;
  24. //if (run!=active) return;
  25. //run = 0; active = 0;
  26.  
  27. Invoke(new MethodInvoker(delegate {
  28. if ( textBox1.Text != lastq || textBox1.Text == "" ) return;//method 2
  29.  
  30. try {
  31. panel1.Controls.Clear();
  32. for (int i = 0; i < sname.Count<string>(); i++) {
  33.  
  34. if (sname[i].ToLower().Contains(t)) {
  35. panel1.Controls.Add(links[i]);
  36. }
  37.  
  38. }
  39. } catch { }
  40. }));
  41. }); tsk.Start();
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement