03-01-2021, 08:41 PM
السلام عليكم ورحمة الله وبركاته
ماهو سطر الكود الذي من خلاله احصي
كل الاسماء والقيم المكررة في المكون StringGrid
واعرضها بالمكون Memo ..بارك الله فيكم 


StringGrid1.Cells[ACol, ARow];var
Acol, ARow: Integer;
begin
for Acol := 0 to Pred(StringGrid1.ColCount) do
for ARow := 1 to Pred(StringGrid1.RowCount) do
begin
End;
جزاك الله كل الخيرإقتباس :خاصة انني اتعلم تعلم بيزنطي وليس اكاديمي
StringGrid1.Cells[0, 1] := 'Salem';
StringGrid1.Cells[0, 2] := 'Omar';
StringGrid1.Cells[0, 3] := 'Khaled';
StringGrid1.Cells[0, 4] := 'Ali';
StringGrid1.Cells[1, 1] := 'Mansor';
StringGrid1.Cells[1, 2] := 'Mohamed';
StringGrid1.Cells[1, 3] := 'Ahmad';
StringGrid1.Cells[1, 4] := 'Naser';
StringGrid1.Cells[2, 1] := 'Thareq';
StringGrid1.Cells[2, 2] := 'Omar';
StringGrid1.Cells[2, 3] := 'Waled';
StringGrid1.Cells[2, 4] := 'Haetem';procedure TForm1.Button1Click(Sender: TObject);
var
Acol, Arow,ListCount: Integer;
begin
for Acol := 0 to Pred(StringGrid1.ColCount) do
for Arow := 1 to Pred(StringGrid1.RowCount) do
begin
ListBox1.Items.Add(StringGrid1.Cells[Acol, Arow]);
for ListCount := 0 to ListBox1.Items.Count -1 do
begin
if ListBox1.Items[ListCount]=StringGrid1.Cells[Acol, Arow+1] then
ListBox2.Items.Add(StringGrid1.Cells[Acol, Arow+1]);
end;
end;
end;for Acol := 0 to Pred(StringGrid1.ColCount) do
for Arow := 1 to Pred(StringGrid1.RowCount) doListBox1.Items.Add(StringGrid1.Cells[Acol, Arow]); begin
if ListBox1.Items[ListCount]=StringGrid1.Cells[Acol, Arow+1] then
ListBox2.Items.Add(StringGrid1.Cells[Acol, Arow+1]);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
var
Acol, Arow,ListCount: Integer;
Tstr:TStrings;
begin
Tstr := TStringList.Create();
try
for Acol := 0 to Pred(StringGrid1.ColCount) do
for Arow := 1 to Pred(StringGrid1.RowCount) do
begin
Tstr.Add(StringGrid1.Cells[Acol, Arow]);
for ListCount := 0 to Tstr.Count -1 do
begin
if Tstr [ListCount]=StringGrid1.Cells[Acol, Arow+1] then
ListBox2.Items.Add(StringGrid1.Cells[Acol, Arow+1]);
end;
end;
finally
Tstr.Free;
end;
end;Tstr:TStrings; Tstr := TStringList.Create();Tstr.Free;try
finally
end;
![[صورة: 365289664.jpg]](https://www9.0zz0.com/2021/01/16/00/365289664.jpg)
for i := 1 to StringGrid1.RowCount -1 do
for j := i+1 to StringGrid1.RowCount -1 do
begin
if StringGrid1.Cells[3, i] = StringGrid1.Cells[3, j] then
begin
s:=s+1;
end;
end;