Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.11.13;
Скачать: CL | DM;

Вниз

Загрузка текстового файла в listview, где ошибка?   Найти похожие ветки 

 
Vitaly00   (2005-10-20 21:47) [0]

Здравствуйте!
Помогите найти ошибку, хочу загрузить текстовый файл в 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;
Заранее, спасибо.


 
vitaly00   (2005-10-20 23:27) [1]

Хочу уточнить, что загружаю файл с текстом:
строка#1
строка#2
строка#3
строка#4
строка#5
строка#6
строка#7
Помогите уже голову сломал


 
beglec ©   (2005-10-21 01:44) [2]

1. Что за ошибка то?  Пойди подскажи то не знаю что.
2. На первый взгляд - определись ты работаешь с Типизированным файлом или с текстовым?

1: if TextFile then var s: string[12] - причем тут ?
2: if Not TextFile then var Mytextfile: textfile - причем тут ?


 
easy ©   (2005-10-21 09:09) [3]

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;



Страницы: 1 вся ветка

Текущий архив: 2005.11.13;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.072 c
2-1129770852
Gale
2005-10-20 05:14
2005.11.13
Быстрая функция Pos не чувствительная к регистру ?


2-1129720063
Df23
2005-10-19 15:07
2005.11.13
Не понимаю, почему так.


4-1126330868
Agile
2005-09-10 09:41
2005.11.13
DllProc вопрос


14-1129992001
Express
2005-10-22 18:40
2005.11.13
Invalid file name


11-1111072940
uuzh
2005-03-17 18:22
2005.11.13
2 ECM Порт FBL под KOL