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 859731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:43:03+00:00 2026-05-15T08:43:03+00:00

I Have A ListBox With 10,000 Items And Many Many Duplicate Items! I Wonna

  • 0

I Have A ListBox With 10,000 Items And Many Many Duplicate Items! I Wonna Save It To A File Without Duplicate Items (One Item Instead All Copies!) And I Use This Way:

Function TMain.List_ExistsIn(ListBox_NAme: TListBox; EParameter: String): Integer;
Var
  i: Integer;
Begin
  EParameter := LowerCase(EParameter);
  Result := -1;
  For i:=0 To ListBox_Name.Items.Count - 1 Do
    If EParameter = Lowercase(ListBox_Name.Items[i]) Then Begin
      Result := i;
      Break;
    End;
End;

I Use Code Above To Detect A Existing Item And Following Procedure To Save It:

Procedure TMain.MakeList(ListBox_Name: TListBox; FileName: String); //================
Var
  i: Integer;
  Temp_ListBox: TListBox;
Begin
  Temp_ListBox := TListBox.Create(Main);
  With Temp_ListBox Do Begin
    Parent := Main;
    Clear;
    For i:=0 To ListBox_Name.Count - 1 Do
      If Main.List_ExistsIn(Temp_ListBox, ListBox_Name.Items[i]) = -1 Then
        Items.Add(ListBox_Name.Items[i]);
    Items.SaveToFile(FileName);
    Free;
  End;
End;

But It Takes A Very Very Long Time To Proceed. Is There Any Better And Fast Way?
Thanks.

  • 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-15T08:43:04+00:00Added an answer on May 15, 2026 at 8:43 am

    Try this one

    procedure TForm1.FormCreate(Sender: TObject);
    var
      StrList: TStringList;
      I: Integer;
    begin
      StrList := TStringList.Create;
      StrList.Sorted := True;
      StrList.Duplicates := dupIgnore;
      StrList.AddStrings(ListBox1.Items);  //Your List Box Items
      StrList.SaveToFile('C:\abc.txt');
      StrList.Free; //Cleanup
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListBox with way too many items in it and the UI
I have a listbox where the items contain checkboxes: <ListBox Style={StaticResource CheckBoxListStyle} Name=EditListBox> <ListBox.ItemTemplate>
I have a ListBox which displays items of variable height. I want to show
I have a ListBox that when in focus, and when I have an item
I have a Listbox that is filled with 30,000 elements <ListBox Name=lbWordlist Grid.Row=1 Margin=10
I have approximately 10,000 records. Each records has 2 fields: one field is a
I have 105 listbox items with checkboxes. When user selects the items, i want
A have ListBox and 4 Items. 2 visible 2 colpased: Click: -this bad! I
I have a ListBox which contains all the Categories and each category will contain
I have a ListBox displaying some items, and in certain modes I stamp a

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.