Solved

ListBox sorting

Posted on 1998-06-23
1
357 Views
Last Modified: 2010-04-04
I need a ListBox that is sorted by third character of Items, not by first. Any way to obtain this?
0
Comment
Question by:bor061297
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
kjteng earned 50 total points
ID: 1355485
The following is a procedure to sort from n-thcharacter of item:

procedure mySort( lb: tListBox; n: integer);
var i: longint;  s: string;
begin
  with lb do begin
    sorted:= false;
    for i:= 0 to items.Count-1 do begin
      s:= items[ i];
      items[ i]:= copy( s, n, length(s))+ copy( s, 1, n-1);
    end; {for}
    sorted:= true;
    sorted:= false;
    for i:= 0 to items.Count-1 do begin
      s:= items[ i];
      items[ i]:= copy( s, length( s)-n+2, length(s))
                  + copy( s, 1, length(s)-n+1);
    end; {for}
  end; {with}
end;

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question