Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void textBox1_TextChanged(object sender, EventArgs e) {
- if (textBox1.Text.Length > 3) {
- active++;
- Draw(textBox1.Text);
- //
- } else if (textBox1.Text.Length == 0) LoadSVnew();
- }
- //static int active = 0,run=0;//method1
- void Draw(string t) {
- tsk = new Task(delegate{
- string lastq = "";
- Invoke(new MethodInvoker(delegate { lastq = textBox1.Text; })); // method 2
- Thread.Sleep(500);
- //method 1
- //run++;
- //if (run!=active) return;
- //run = 0; active = 0;
- Invoke(new MethodInvoker(delegate {
- if ( textBox1.Text != lastq || textBox1.Text == "" ) return;//method 2
- try {
- panel1.Controls.Clear();
- for (int i = 0; i < sname.Count<string>(); i++) {
- if (sname[i].ToLower().Contains(t)) {
- panel1.Controls.Add(links[i]);
- }
- }
- } catch { }
- }));
- }); tsk.Start();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement