title: How can I make the Program wait a Certain time?
body: <p>So what my exact problem is, is that I want the program to wait 3 seconds and if nothing happens id should execute whatever method I called. But if someone enteres something in these 3 seconds the timer should start again.</p>
  <p>Threadsleep doesnt work because it blocks everything and you cant give any inputs.</p>
  <p>For example, I have a Filter function and now I dont want to filter right after he entered a letter, I wait 3 seconds and if nothing happend I start filtering. I need this so my Program wont take to long for filtering every single letter.</p>
  <p><a href="https://i.stack.imgur.com/Z3Xud.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z3Xud.png" alt="Here you can see how im Filtering by the Letter A but it instantly Filters it right after i typed A" /></a></p>
  <p>Here is my current code from the Filtermethod:</p>
  <pre><code>private void ContainsFilter(object sender, EventArgs e, TextBox textBox, DataGridView dataGridView, int columnIndex)
          {
              if (textBox.Text != &quot;&quot;)
              {
                  var value = &quot;&quot;;
                  var filterText = &quot;&quot;;
                  for (int i = 0; i &lt; dataGridView.RowCount; i++)
                  {
                      value = Convert.ToString(dataGridView.Rows[i].Cells[columnIndex].Value);
                      value = value.ToLower();
                      filterText = textBox.Text;
                      filterText = filterText.ToLower();
                      if (value.Contains(filterText) == false)
                      {
                          dataGridView.Rows[i].Visible = false;
                      }
                      else
                      {
                          dataGridView.Rows[i].Visible = true;
                      }
                  }
                  return;
              }
              for (int i = 0; i &lt; dataGridView.RowCount; i++)
              {
                  dataGridView.Rows[i].Visible = true;
              }
              return;
          }
  </code></pre>