![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Загрузка текстового файла в listview, где ошибка? [D5, Win95/98, WinXP]
Vitaly00 © (2005-10-20 21:47:00)Здравствуйте!
Помогите найти ошибку, хочу загрузить текстовый файл в listview:
procedure TForm1.Button5Click(Sender: TObject);
var
i,j:integer;
Mytextfile: textfile;
s: string[12];
begin
AssignFile(Mytextfile,'Mytextfile.txt');
Reset(Mytextfile);
try
while not Eof(Mytextfile) do
begin
Readln(Mytextfile, s,j);
for i:=0 to j do
begin
ListView1.Items.Add.Caption:=inttostr(i);
ListView1.Items.Item[i].SubItems.add(S);
end;
end;
finally
Closefile(Mytextfile);
end;
end;
Заранее, спасибо.
easy (2005-10-21 09:09:00) [1]
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
Mytextfile: textfile;
s: string[12];
item: TListItem;
begin
AssignFile(Mytextfile, 'c:\boot.ini');
Reset(Mytextfile);
try
i := 1;
while not Eof(Mytextfile) do
begin
Readln(Mytextfile, s);
item := ListView1.Items.Add;
item.Caption := inttostr(i);
item.SubItems.add(S);
inc(i);
end;
finally
Closefile(Mytextfile);
end;
end;
beglec (2005-10-21 01:44:00) [2]1. Что за ошибка то? Пойди подскажи то не знаю что.
2. На первый взгляд - определись ты работаешь с Типизированным файлом или с текстовым?
1: ifTextFile then vars: string[12] - причем тут ?
2: ifNot TextFile then varMytextfile: textfile - причем тут ?
vitaly00 (2005-10-20 23:27:00) [3]Хочу уточнить, что загружаю файл с текстом:
строка#1
строка#2
строка#3
строка#4
строка#5
строка#6
строка#7
Помогите уже голову сломал