title: how load a list in a combobox in vb.net using a combobox
body: <p>I have a form where i need to pull items list in a combobox with a query as parameter.
  In the database i have three fields for positions like development ,networking finance which are stored as yes or no based on tick on a checkbox.so if a company has positions for dev and its ticked the value in dB is Yes otherwise no.so on a form i am trying to load details in a combo box the names of the companies that have the positions available. and that i am trying to do that from a combo box for position which has dev,net,fin as items so if one selects dev then the query should look for the companies which have dev position as yes and reader should read it and display it in the combo box.  any help on this..... here is my code.... thanks in advance.</p>
  
  <pre><code> Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
      If ComboBox3.Text = "Developer" Then
          Dim dbprovider As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Taher\Documents\Visual Studio 2010\Projects\WindowsApplication1\WindowsApplication1\Database1.accdb;Persist Security Info=False;"
          Me.con = New OleDb.OleDbConnection
          Dim sqlquery As String = "SELECT cname FROM company WHERE dev='"yes"';"
          Dim command As New OleDb.OleDbCommand(sqlquery, con)
          Dim reader As OleDb.OleDbDataReader
          con.ConnectionString = dbprovider
          con.Open()
  
          reader = command.ExecuteNonQuery()
          reader.Read()
  
          ComboBox3.SelectedItem.ToString()
  
      End If
  End Sub
  </code></pre>