title: Get value member from combo box
body: <p>Done a fair bit of searching on this, but cannot find anything specific enough.</p>
  
  <p>I am try to get the value member from my combobox, the reason being that the selected <code>valuemember</code> will form the basis of a query to populate a datagridview.</p>
  
  <p>The below code looks at dbo.Calendar on a T-SQL database.  The column <code>month</code> is just the number for the month i.e. 1-12 and <code>MonthName</code> is as the name suggests.</p>
  
  <p>Testing the <code>valuemember</code> output in the <code>MsgBox</code> command below, the output just gives me "month", rather than say "5" if the user selects "May" in the combobox.  Consequently, I am passing the string "Month" to try to populate my datagridview when I should be passing "5".  Anyone able to help on why I am not getting "5"?</p>
  
  <pre><code>Dim command As SqlCommand
          Dim adapter As New SqlDataAdapter()
          Dim ds As New DataSet()
          Dim sql As String
          sql = "select distinct month, MonthName from Calendar order by month asc"
          Try
              conn.Open()
              command = New SqlCommand(sql, conn)
              adapter.SelectCommand = command
              adapter.Fill(ds)
              adapter.Dispose()
              Command.Dispose()
              conn.Close()
              MonthSearch.DataSource = ds.Tables(0)
              MonthSearch.ValueMember = "month"
              MonthSearch.DisplayMember = "MonthName"
              MsgBox(MonthSearch.ValueMember)
          Catch ex As Exception
              MessageBox.Show("Cannot open connection! ")
          End Try
  </code></pre>