title: VB.NET 2010 - Populating a combobox from multiple columns in an access database
body: <p>I have recently had a question answered on how to fill a combobox from an access database, however my latest problem is a little trickier for me. </p>
  
  <p>I need to populate my next combobox from TWO columns from a table, ie:</p>
  
  <p>Reasoncode - Reason</p>
  
  <p>so i want my combo box to look as follows -</p>
  
  <p>A - Accounts</p>
  
  <p>S - Sales</p>
  
  <p>ST - System Tidy</p>
  
  <p>However the reason code and the reason description are stored in two seperate columns in my database and they cannot be joined together. Is this possible in VB.Net, to pull multiple columns into one combobox?</p>
  
  <p>My current code to populate the box (courtesy of LarsTech)</p>
  
  <pre><code>Protected Overrides Sub OnLoad(e As EventArgs)
      Dim ds1 As New DataSet()
      Dim ConnnectionString1 As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Admin\Desktop\CancellationsAndMovements\CancellationsandMovements\cancmov.mdb"
  
      Dim db1 As String = "SELECT reasoncode FROM Reason"
  
      Using cn1 As New OleDbConnection(ConnnectionString1)
          Using da As New OleDbDataAdapter(db1, cn1)
              da.Fill(ds1, "reasoncode")
          End Using
      End Using
  
      With drpMoveReason
          .DisplayMember = "reasoncode"
          .DataSource = ds1.Tables("reasoncode")
          .SelectedIndex = 0
      End With
  
      MyBase.OnLoad(e)
  
  End Sub
  </code></pre>
  
  <p>The extra column i want to pull is called "reasondesc"</p>
  
  <p>If it is possible to fill this way any help would be greatly appreciated, also appreciated would be aby help in how i would write back ONLY the reason code when i write back to a different database.</p>
  
  <p>Thank you in advance.</p>