
02.12.2008, 22:40
|
Прохожий
|
|
Регистрация: 27.11.2008
Адрес: Volgograd
Сообщения: 11
Репутация: 10
|
|
Код:
procedure TForm1.BitBtn1Click(Sender: TObject);
Var
i,j,n : integer;
s,st: String ;
begin
if OpenDialog1.Execute=true then begin // Открыть текстовый файл
ListBox1.Items.Clear;
ListBox1.Items.LoadFromFile(OpenDialog1.FileName); // Загрузка файла
StringGrid1.RowCount:=ListBox1.Items.Count; // Задание кол. строк в таблице
for i:=0 to ListBox1.Items.Count-1 do begin
s:=ListBox1.Items[i];
st:='';j:=1;
Repeat st:=st+s[j]; j:=j+1; Until (s[j]=';');
StringGrid1.Cells[0,i+1]:=st;
j:=j+1;st:='';
Repeat st:=st+s[j]; j:=j+1; Until (s[j]='|');
StringGrid1.Cells[1,i+1]:=st;
j:=j+1;st:='';
Repeat st:=st+s[j]; j:=j+1; Until (s[j]='|');
StringGrid1.Cells[2,i+1]:=st;
j:=j+1;st:='';
Repeat st:=st+s[j]; j:=j+1; Until (s[j]=')');
StringGrid1.Cells[3,i+1]:=st;
j:=j+1;st:='';
end;
end;
Примерно это выглядит так..
Moderatorial: Пользуемся тегами. Иначе последуют санкции.
|