
12.05.2013, 21:09
|
 |
LMD-DML
|
|
Регистрация: 12.07.2009
Адрес: Богородское
Сообщения: 3,025
Версия Delphi: D7E
Репутация: 1834
|
|
Вместо мемо нужен листбокс
Код:
function nu(ds: string): string;
begin
Result:= Copy(ds, 1, pos(',', ds)-1);
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var
i, b5, b6: integer;
sl, sv: TStrings;
begin
sv:= TStringList.Create;
sl:= TStringList.Create;
for i := 0 to ListBox1.Items.Count-1 do
if nu(ListBox1.Items.Strings[i]) = nu(ListBox1.Items.Strings[listbox1.ItemIndex]) then
sv.Add(ListBox1.Items.Strings[i]);
b5:= 0;
b6:= 0;
for i := 0 to sv.Count-1 do
begin
sl.Text:= StringReplace(sv.Strings[i],',',#10,[rfReplaceAll]);
inc(b5, StrToInt(sl.Strings[4]));
inc(b6, StrToInt(sl.Strings[5]));
end;
Label1.Caption:='Столбец 5: '+IntToStr(b5);
Label2.Caption:='Столбец 6: '+ IntToStr(b6);
sl.Free;
sv.Free;
end;
|