delphi如何把一个文本列表添加到TListBox并避免重复项


本文整理自网络,侵删。

 delphi如何把一个文本列表添加到TListBox并避免重复项

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
const
FilePath = 'c:\temp\Test.txt';
var
List: TStringList;
begin
List := TStringList.Create;
List.Sorted := True;
List.Duplicates := dupIgnore;
List.LoadFromFile(FilePath);
ListBox1.Items.Assign(List);
List.Free;
end;

end.

相关阅读 >>

Delphi android windows ios通用获取程序版本

Delphi 加载图像并压缩,旋转图像角度

Delphi getexplorerpid获取系统explorer.exe进程id

Delphi 使用windows api(wincrypt)计算文件md5哈希,支持大文件

Delphi 整理内存

Delphi 用firedac处理sqlite的日期型

Delphi xe 10.2.1 fmx平台 在图片上写字方法

Delphi 中format的字符串格式化使用说明

Delphi 数据类型cardinal 怎么转换成 string?

Delphi xe5 android 调用手机震动(通过jobject测试是否支持震动)

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...