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

  • SEARCH
  • Home
  • 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 8523243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:21:16+00:00 2026-06-11T07:21:16+00:00

I need the user to pick a date format (dd/mm/yyyy or dd mmmm yyyy

  • 0

I need the user to pick a date format (dd/mm/yyyy or dd mmmm yyyy etc…) but displaying these options is just confusing. What I want to be able to do is have the TComboBox items filled with “14/09/2012”, “14 September 2012”, “Friday 14 September 2012” etc, and when the user picks one of these date formats the combobox gets the text “dd mmmm yyyy” or whatever the date format is (although I still want them to be able to type in something else such as “d/m/yy”).

However I haven’t found an easy way of doing this – other than a TEdit with a TSpeedButton which opens a form with the selection options in it which is my second choice if there is no way to do this with a TComboBox.

Question: How can I have a TComboBox dropdown display dates, but the text property gets the date format when a date is picked?

  • 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-06-11T07:21:18+00:00Added an answer on June 11, 2026 at 7:21 am

    It is not possible to directly do this via the OnChange event on the ComboBox, as after the OnChange event the text property gets set back to whatever was picked by the user. However I can send a message to the form to make the change.

    procedure TfINISettings.cbLongDateFormatChange(Sender: TObject);
    begin
      PostMessage(Handle, WM_USER, 0, 0);
    end;
    

    and in the form interface declare a procedure

    procedure DateFormatComboBoxChange(var msg: TMessage); message WM_USER;
    

    to handle this message, and in the implementation

    procedure TfINISettings.DateFormatComboBoxChange(var msg: TMessage);
    begin
      if cbLongDateFormat.ItemIndex <> -1 then
        cbLongDateFormat.Text := DateFormats[cbLongDateFormat.ItemIndex];
    end;
    

    Where DateFormats is a TStringList that contains my date formats. The FormCreate method looks like this

    procedure TfINISettings.FormCreate(Sender: TObject);
    var
      d: String;
    begin
      DateFormats := TStringList.Create;
      DateFormats.Add('ddddd');
      DateFormats.Add('dddddd');
      DateFormats.Add('d mmmm yyyy');
      for d in DateFormats do
        cbLongDateFormat.Items.Add(FormatDateTime(d, now));
    end;
    

    Suggestions on improvements welcome.

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

Sidebar

Related Questions

I have a server with php4 and pho5 support. But i need to user
I need a way of allowing a user to pick on option out of
i'm using this control for date picker. i want that when user click on
I am using a standard date picker to allow the user to pick a
I need to limit what Dates a user can pick from the com.google.gwt.user.datepicker.client.DateBox .
In my project I want to let the user pick a picture either from
I need to display 3 rows from which a user can pick values by
I need a control where user can pick a number from a list like
I need to allow user to pick images and then save the base64 image
I need user to define all the environment variables needed for my program in

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.