title: VB.NET - Number of Combobox Items should be based on the number of records in the database
body: <p>I have a problem here on <code>vb.net</code>.</p>
  
  <p>I have a program here connected to a database with fields (<code>id</code> , <code>name</code>, <code>quantity</code>) on table <code>tbl_report</code></p>
  
  <p>Part of my program is to delete a record that has an <code>ID</code> equals to the selected item of <code>cbOrderNo</code></p>
  
  <p>The items of cbOrderNo are the IDs from the table. So when a record is deleted, items of <code>cbOrderNo</code> supposedly will be deducted.</p>
  
  <p>So for example, there are 4 records in the table so during the form load there will be 4 items in <code>cbOrderNo</code> and when the user selects 1 of the items in the combobox, a record will be deleted so 3 records will be left and so as 3 items in <code>cbOrderNo</code></p>
  
  <p>What my program is doing is that after 3 records are left, there will still be 4 items in the combobox. What I want is to show only 3 items there.</p>
  
  <pre><code>Dim qryDelete As String = "DELETE FROM tbl_report WHERE ID=" &amp; cbOrderNo.SelectedItem &amp; ""
  ExecNonQuery(qryDelete)
  MsgBox("Record Deleted")
  query.Close()
  
  cbOrderNo.Items.Clear()
  cmd.CommandText = "SELECT * FROM tbl_report ORDER BY ID"
  cmd.Connection = con
  Dim rdrOLEDB As OleDbDataReader = cmd.ExecuteReader
  While(rdrOLEDB.Read())
       cbOrderNo.Items.Add(rdrOLEDB.GetValue(0))
      MsgBox(cbOrderNo.Items.Count)
  End While
  MsgBox(cbOrderNo.Items.Count)
  cbOrderNo.SelectedIndex = 0
  rdrOLEDB.Close()
  </code></pre>