示例#1
0
 private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
 {
     listBox1.Items.Clear();
     if (e.KeyChar == (char)8)
     {
         searchString = searchString.Remove(searchString.Length - 1);
         taskList     = ts.GetSearchByChacter(searchString);
         for (int i = 0; i < taskList.Count; i++)
         {
             listBox1.Items.Add(taskList[i].Task_ID + " - " + taskList[i].Tittle + " - " + taskList[i].Date + " - " + taskList[i].Time);
         }
     }
     else
     {
         searchString += e.KeyChar;
         taskList      = ts.GetSearchByChacter(searchString);
         for (int i = 0; i < taskList.Count; i++)
         {
             listBox1.Items.Add(taskList[i].Task_ID + " - " + taskList[i].Tittle + " - " + taskList[i].Date + " - " + taskList[i].Time);
         }
     }
 }