Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3282300
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:54:45+00:00 2026-05-17T19:54:45+00:00

I am looking for a way to provide a ListSource to a TDBLookupComboBox in

  • 0

I am looking for a way to provide a ListSource to a TDBLookupComboBox in delphi without having an actual table on the database server to draw that list from. The DataField for the Combo Box is a 1 character field that contains a coded value such as ‘A’ = ‘Drivers License’, ‘B’ = ‘Passport’, ‘C’ = ‘Library Card’, etc. That is to say that the table only contains A, B, or C. The application is responsible for Displaying ‘Drivers License’ in the GUI. Normally a database might have a look up table but this database does not and I can not add one. My idea is that the DataSource and ListSource for a DB Look-up control do not have to be the same database, so if it were possible to define a small table in my form that contains the look-up data then I could use that an not require a real database table.

Does anyone know of a delphi component that allows a TDataSet to be defined on a form without having any actual data files behind it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:54:46+00:00Added an answer on May 17, 2026 at 7:54 pm

    An alternative solution is to use TComboBox rather than TDBLookupComboBox. Use a TDictionary to define a simple in memory lookup.

    type
      TMyForm = class(TForm)
        MyComboBox: TComboBox;
        MyDataset: TSimpleDataSet;
        procedure MyComboBoxChange(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        ComboLookup: TDictionary<string, Char>;
      end;
    
    implementation
    
    {$R *.dfm}
    
    procedure TMyForm.FormCreate(Sender: TObject);
    var
      Key: string;
    begin
      ComboLookup := TDictionary<string, Char>.Create;
      ComboLookup.Add('Drivers License', 'A');
      ComboLookup.Add('Passport', 'B');
      ComboLookup.Add('Library Card', 'C');
      for Key in ComboLookup.Keys do
      begin
        MyComboBox.Items.Add(Key);
      end;
    end;
    
    procedure TMyForm.MyComboBoxChange(Sender: TObject);
    begin
      // This may be wrong didn't bother to look
      //up the correct way to change a field's value in code.
      MyDataset.Fields.FieldByName('IDCard').AsString := ComboLookup[MyComboBox.Text];
    end;
    

    You could use TComboBox.Items.AddObject instead of a separate lookup table but you’d have to create a wrapper class to store a char as a TObject or use Chr to convert it to an integer then cast it to TObject but a the above is simpler in my opinion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a way to create a formula field that will list
I'm looking for a way to get a random database entry (Video) that has
We are looking for a way to provide failover for ACS instances, so if
I'm currently looking for a way to provide the user with being able to
I'm looking for some advice on the best way to provide a single place
I am looking to provide a better way of managing the distribution and storage
I'm looking for way to create list view as like in IOS with pinned
I was looking at the boost serialization library, and the intrusive way to provide
I'm looking for a way to convert a string that contains a character escape
I'm looking for a way to implement a bidirectional RPC in node.js (means that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.