title: How do I get the SelectedValue of a ComboBox from code?
body: <p>I am trying to build something like a <code>TLookupComboBox</code> using LiveBindings.</p>
  
  <p>I have placed a normal <code>TComboBox</code> on a VCL form. I also have a data set with some rows that have the two fields <code>id</code> and <code>text</code>.</p>
  
  <p>Then I used the LiveBindings editor to create a <code>TBindSourceDB</code> and a <code>TBindingsList</code>.</p>
  
  <p>There is just one binding in it:</p>
  
  <pre><code>object BindingsList1: TBindingsList
    Methods = &lt;&gt;
    OutputConverters = &lt;&gt;
    UseAppManager = True
    Left = 244
    Top = 229
    object LinkFillControlToField1: TLinkFillControlToField
      Category = 'Quick Bindings'
      Control = ComboBox1
      Track = True
      FillDataSource = BindSourceDB1
      FillValueFieldName = 'id'
      FillDisplayFieldName = 'text'
      AutoFill = True
      BufferCount = -1
      FillExpressions = &lt;&gt;
    end
  end
  </code></pre>
  
  <p>As you can see I have different fields for <code>FillValueFieldName</code> and <code>FillDisplayFieldName</code>.</p>
  
  <p>The LiveBindings designer looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/75w8F.png" alt="BindSourceDB1 connected to ComboBox1"></p>
  
  <p>The ComboBox is filled with the values from the field <code>text</code>, so I think I set it up correctly.</p>
  
  <p>How can I get the <code>SelectedValue</code> from code?</p>
  
  <p>I could visually bind the value to a <code>TLabel</code> and then I could read the <code>TLabel.Caption</code>, but surely there is an easier way?</p>
  
  <p>PS: I do not want to store the value in the DB, otherwise I would just use a <code>TDBLookupComboBox</code>.</p>
  
  <p><strong>Edit:</strong> I have tried to use a <code>TPrototypeBindSource</code>, but that has no obvious way to access the fields from code. I have also tried to use a second <code>TBindSourceDB</code> together with a <code>TClientDataSet</code> which works, but that feels like using a sledgehammer to crack a nut.</p>