• Homework
  • Thirds
  • Upper Thirds
  • Fourth
  • Divisions
    • ICT
    • Computer Science
  • Fifth
  • Lower Sixth
  • Upper Sixth
    • Upper Sixth Theory
  • Blog
  • Careers
  • Unity
  • Networking

Delphi and Access Walkthrough

Adding a combo box - with a drop down list from your data

The previous section of the tutorial (click here for the index) has brought us to the point where we have basic data on our form.

Our form has a FDConnection, FDTable, and FDDatasource components, together with a couple of fields which display our database data.  We also have a system provided navigator at the bottom.

We're going to replace the plain Username field with a drop down combo box that will list all of the pupil names in the database.
Picture

Picture
From the tool palette search for TDBLookupComboBox.  There are two very similar controls, one called TDBLookupCombo, the other TDBLookupComboBox.  The latter looks better.

Drag this control onto your form


In the Object Inspector at the bottom left of the screen, scroll down past the normal datasource options to find the ListSource.  Set that to your datasource.  

The ListField and Keyfields control what items are displayed in the drop down part of the combo box.
Picture
Picture
Try it out.  You should have a drop down list populated from your database.

Next steps:  Using SQL to join tables

Powered by Create your own unique website with customizable templates.