delphi 小程序 如何实现?

fly2sky 2010-11-19 09:30:51
有个小程序 我想实现这样的功能~

1。读个文件,文件内容如下“...”代表省略

ALIST
曹操 cc
刘备 lb
...
BLIST
无懈可击 wxkj
南蛮入侵 nmrq
...

2。把这个文件的ALIST内容读到一个 checklistBox中,把BLIST读取到一个CombList中

如何实现呢,嘿嘿,我刚学delphi没多久~~ 希望大家指点一下关键的地方和注意的地方,最好贴伪代码~~
...全文
112 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
fly2sky 2010-11-19
  • 打赏
  • 举报
回复
顺便问大侠一个问题,那个checklistbox的 name和caption我想分开,即显示的是名称,然后它的唯一值是字母,我添加的时候要怎么添加呢~~ 谢谢~

[Quote=引用 1 楼 bdmh 的回复:]
Delphi(Pascal) code

var
list:TStringList;
i,j:Integer;
begin
j := 1;
list := TStringList.Create;
list.LoadFromFile('c:\1.txt');
for i := 0 to list.Count - 1 do
begin
if l……
[/Quote]
haitao 2010-11-19
  • 打赏
  • 举报
回复
如果是:
[ALIST]
曹操 cc
刘备 lb
...
[BLIST]
无懈可击 wxkj
南蛮入侵 nmrq
...
就可以按ini方式处理,可以使用Tmeminifile类
bdmh 2010-11-19
  • 打赏
  • 举报
回复

var
list:TStringList;
i,j:Integer;
begin
j := 1;
list := TStringList.Create;
list.LoadFromFile('c:\1.txt');
for i := 0 to list.Count - 1 do
begin
if list.Strings[i] = 'BLIST' then
j := 2;
if (j = 1) and (list.Strings[i]<>'ALIST') and (list.Strings[i]<>'') then
begin
CheckListBox1.Items.Add(list.Strings[i]);
end
else if (j=2) and (list.Strings[i]<>'BLIST') and (list.Strings[i]<>'') then
begin
ComboBox1.Items.Add(list.Strings[i]);
end;
end;
list.Free;
end;

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧