title: Select and get data from filtered "checkedListBox"
body: <p>I'm new to c# so excuse the sloppy coding.
  I got data that I'm implementing in to a checkedListBox by clicking a button. I'm using a textBox for a dynamic filter function.</p>
  
  <pre><code>        string loc_ShortNamesAndPIDs_S22 = "";
          service22Items = new DataTable();
          service22Items.Columns.Add("Service22");
  
          for (int i = 0; i &lt; loc_Service22Infos.GetLength(0); i++)
              {
              loc_ShortNamesAndPIDs_S22 = "[" + loc_Service22Infos[i].variant + "] PID "
                                          + loc_Service22Infos[i].parameterId_hex
                                          + ": " + loc_Service22Infos[i].shortName;
              //checkedListBox_Service22Data.Items.Add(loc_ShortNamesAndPIDs_S22);
              service22Items.Rows.Add(loc_ShortNamesAndPIDs_S22);
              }
  
          checkedListBox_Service22Data.DataSource = ReutrnService22Items();
          checkedListBox_Service22Data.DisplayMember = "Service22";
          }
  
          private DataTable ReutrnService22Items()
          {
          return service22Items;
          }
  </code></pre>
  
  <p>So after I put the data into my checkedListBox I'm using the following code for the filter:</p>
  
  <pre><code>    private void srchBoxItems_TextChanged(object sender, EventArgs e)
      {
         DataView dvNumbers = service22Items.DefaultView;
         dvNumbers.RowFilter = "Service22 LIKE '%" + srchBoxItems.Text + "%'";
      }
  </code></pre>
  
  <p>So now I'm able to Filter my Data, the only Problem I got, when I'm checking the check boxes to selected the Data I want to and filter everything it unchecks the check boxes. 
  Therefore I was thinking to store the already checked indices and check them again (just a part of the code)...</p>
  
  <pre><code>       List&lt;int&gt; checkedList = new List&lt;int&gt;();
          serviceForm.ShowDialog();
          this.Show();
          for (int checkedItems_Counter = 0; checkedItems_Counter &lt; checkedListBox_Service22Data.CheckedIndices.Count; checkedItems_Counter++)
          {
              checkedList.Add(checkedItems_Counter);
              checkedList.ToArray();
  </code></pre>
  
  <p>but that doesn't work because when you filter the data, the data that had the indices, lets say 56, will have the indices 1.</p>
  
  <p>So my questions are:</p>
  
  <p>Is there a way to keep the check boxes checked even though I'm filtering? I couldn't find anything...If yes this would be already the solution.</p>
  
  <p>If not, ist there maybe a more elegant way to implement a dynamic filter that doesn't come with such a problem.</p>
  
  <p>Is there a possibility to keep the indices that the data has when it is uploaded into the checkedListBox for the first time. Is there an elegant way or do I have to add an indices variable?</p>
  
  <p>If there are any further questions please let me know and thanks in advance for your help!</p>